summaryrefslogtreecommitdiff
path: root/elisp/geiser-completion.el
diff options
context:
space:
mode:
Diffstat (limited to 'elisp/geiser-completion.el')
-rw-r--r--elisp/geiser-completion.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/elisp/geiser-completion.el b/elisp/geiser-completion.el
index 99a3cfc..0752e5c 100644
--- a/elisp/geiser-completion.el
+++ b/elisp/geiser-completion.el
@@ -11,6 +11,7 @@
+(require 'geiser-impl)
(require 'geiser-eval)
(require 'geiser-log)
(require 'geiser-syntax)
@@ -183,13 +184,20 @@ terminates a current completion."
(minibuffer-message text)
(message "%s" text))))
-(make-variable-buffer-local
- (defvar geiser-completion--symbol-begin-function nil))
+(defvar geiser-completion--symbol-begin-function nil)
+
+(defsubst geiser-completion--def-symbol-begin (module)
+ (save-excursion (skip-syntax-backward "^-()>") (point)))
+
+(geiser-impl--register-local-method
+ 'geiser-completion--symbol-begin-function 'find-symbol-begin
+ 'geiser-completion--def-symbol-begin
+ "An optional function finding the position of the beginning of
+the identifier around point. Takes a boolean, indicating whether
+we're looking for a module name.")
(defsubst geiser-completion--symbol-begin (module)
- (or (and geiser-completion--symbol-begin-function
- (funcall geiser-completion--symbol-begin-function module))
- (save-excursion (skip-syntax-backward "^-()>") (point))))
+ (funcall geiser-completion--symbol-begin-function module))
(defsubst geiser-completion--prefix (module)
(buffer-substring-no-properties (point)