summaryrefslogtreecommitdiff
path: root/elisp/geiser-syntax.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-08-17 04:18:02 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-08-17 04:18:02 +0200
commitf4b4ba80ce66f7ae21d436103b6bc8262d211305 (patch)
tree17d576801b41ce3fbbb11d4b33ae3826401c3471 /elisp/geiser-syntax.el
parentded319e99f9c15a1384e5afee6329509a134117d (diff)
downloadgeiser-f4b4ba80ce66f7ae21d436103b6bc8262d211305.tar.gz
geiser-f4b4ba80ce66f7ae21d436103b6bc8262d211305.tar.bz2
Simpler, more correct and efficient autodoc implementation.
Not that it was difficult: it's replacing an ugly kludge.
Diffstat (limited to 'elisp/geiser-syntax.el')
-rw-r--r--elisp/geiser-syntax.el27
1 files changed, 27 insertions, 0 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index db1c842..475a556 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -94,6 +94,33 @@
(defsubst geiser-syntax--beginning-of-form ()
(memq (char-after (point)) '(?\" ?\()))
+(defun geiser-syntax--scan-sexp ()
+ (let ((p (point))
+ (n -1)
+ prev
+ head)
+ (ignore-errors
+ (backward-up-list)
+ (save-excursion
+ (forward-char)
+ (skip-syntax-forward "^_w" p)
+ (when (setq head (symbol-at-point))
+ (while (< (point) p)
+ (setq n (1+ n))
+ (setq prev (symbol-at-point))
+ (forward-sexp))))
+ (if head (list head n prev) 'skip))))
+
+(defun geiser-syntax--scan-sexps ()
+ (save-excursion
+ (goto-char (or (nth 8 (syntax-ppss)) (point)))
+ (let* ((sap (symbol-at-point))
+ (path (and sap `((,sap 0))))
+ s)
+ (while (setq s (geiser-syntax--scan-sexp))
+ (when (listp s) (push s path)))
+ path)))
+
(defun geiser-syntax--complete-partial-sexp (buffer begin end)
(geiser-syntax--with-buffer
(erase-buffer)