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
commit5f64d69c0e8c100c5a9954a0b1317d9d345a78e2 (patch)
tree46fdfde9f3ea107b49c7555886eca68301f13553 /elisp/geiser-completion.el
parentaecb2b8a0debdfd29e6865c2f4854b37210d9160 (diff)
downloadgeiser-5f64d69c0e8c100c5a9954a0b1317d9d345a78e2.tar.gz
geiser-5f64d69c0e8c100c5a9954a0b1317d9d345a78e2.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)