summaryrefslogtreecommitdiff
path: root/src/geiser
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2023-12-27 15:12:56 +0000
committerjao <jao@gnu.org>2023-12-27 15:12:56 +0000
commit6e0811c75d13c3c8488e7a11a018e1ea2ae3288a (patch)
treecf0b13064aa5f4fa68ab5cdaa5381f571f7a66ad /src/geiser
parentee33af6b4ef8fdaccbdf93c62b50fe17c07a1ade (diff)
downloadgeiser-guile-6e0811c75d13c3c8488e7a11a018e1ea2ae3288a.tar.gz
geiser-guile-6e0811c75d13c3c8488e7a11a018e1ea2ae3288a.tar.bz2
better detection of completion prefixes for module names
Fixes issue #38 (use-modules not completed at buffers) by excluding trailing parens from module name completion prefixes. Things could be better if geiser detected that in, say (use-modules (ice-9 and| one is still completing a module name (right now, it notices that `and' can be completed as a procedure/macro name), but that has always been above module name completion's paycheck.
Diffstat (limited to 'src/geiser')
-rw-r--r--src/geiser/completion.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/geiser/completion.scm b/src/geiser/completion.scm
index d69859b..330f50e 100644
--- a/src/geiser/completion.scm
+++ b/src/geiser/completion.scm
@@ -1,6 +1,6 @@
;;; completion.scm -- completing known symbols and module names
-;; Copyright (C) 2009, 2012 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2012, 2023 Jose Antonio Ortega Ruiz
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
@@ -21,7 +21,8 @@
(sort! (map symbol->string (apropos-internal prefix)) string<?)))
(define (module-completions prefix)
- (let* ((prefix (string-append "^" (regexp-quote prefix)))
+ (let* ((prefix (regexp-substitute/global #f "\\)*$" prefix 'pre "" 'post))
+ (prefix (string-append "^" (regexp-quote prefix)))
(matcher (lambda (s) (string-match prefix s)))
(names (filter matcher (all-modules))))
(sort! names string<?)))