summaryrefslogtreecommitdiff
path: root/elisp/geiser-completion.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-09-22 22:43:28 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-09-22 22:43:28 +0200
commitac2066b6f439b2497e761fbd99c9675db0b03bbd (patch)
tree0370d7256ca125510dba4b5912220a7d064fb702 /elisp/geiser-completion.el
parent8588781981a686dbd921c377fa9887bcd74728af (diff)
downloadgeiser-chez-ac2066b6f439b2497e761fbd99c9675db0b03bbd.tar.gz
geiser-chez-ac2066b6f439b2497e761fbd99c9675db0b03bbd.tar.bz2
New implementation registration mechanism, for the elisp side of things.
Implementations must invoke define-geiser-implementation with an appropriate set of methods. Simple inheritance is supported. Each geiser module defines and registers the method names it uses.
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)