summaryrefslogtreecommitdiff
path: root/elisp/geiser-syntax.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-08-27 00:05:13 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-08-27 00:05:13 +0200
commitb75fa717536a55a7571abfd1aafe53bc73bb5363 (patch)
tree208d8480312289919b2ee4dfac577f59991a19bc /elisp/geiser-syntax.el
parent54ef9eae095606180a137bf2d2c11086625a7088 (diff)
downloadgeiser-chez-b75fa717536a55a7571abfd1aafe53bc73bb5363.tar.gz
geiser-chez-b75fa717536a55a7571abfd1aafe53bc73bb5363.tar.bz2
Better detection of locals (internal defines).
- The implementation is still buggy, though, because it uses the elisp reader, which bails at some scheme syntaxes (e.g. chars)
Diffstat (limited to 'elisp/geiser-syntax.el')
-rw-r--r--elisp/geiser-syntax.el21
1 files changed, 16 insertions, 5 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index 789b6e9..937107b 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -144,10 +144,13 @@
geiser-syntax--delim-regexp))
(defconst geiser-syntax--ldefine-regexp
- (format "\\=[[(]define%s%s" geiser-syntax--ident-regexp geiser-syntax--delim-regexp))
+ (format "[[(]define%s%s" geiser-syntax--ident-regexp geiser-syntax--delim-regexp))
(defconst geiser-syntax--define-regexp
- (format "\\=[[(]\\(?:define\\|lambda\\)%s[[(]" geiser-syntax--delim-regexp))
+ (format "[[(]\\(?:define\\)%s[[(]" geiser-syntax--delim-regexp))
+
+(defconst geiser-syntax--lambda-regexp
+ (format "[[(]\\(?:lambda\\)%s[[(]" geiser-syntax--delim-regexp))
(defun geiser-syntax--locals-around-point ()
(when (eq major-mode 'scheme-mode)
@@ -165,13 +168,21 @@
(dolist (l (nreverse (geiser-syntax--read-list p)))
(when (and (listp l) (symbolp (car l)))
(push (car l) ids))))
+ ((looking-at geiser-syntax--ldefine-regexp)
+ (when (match-string 1) (push (intern (match-string 1)) ids))
+ (goto-char (min p (match-end 0))))
+ ((or (looking-at geiser-syntax--define-regexp)
+ (looking-at geiser-syntax--lambda-regexp))
+ (goto-char (min p (1- (match-end 0))))
+ (dolist (s (nreverse (geiser-syntax--read-list p)))
+ (let ((sn (if (listp s) (car s) s)))
+ (when (symbolp sn) (push sn ids)))))
((re-search-forward geiser-syntax--ldefine-regexp p t)
(when (match-string 1) (push (intern (match-string 1)) ids)))
((re-search-forward geiser-syntax--define-regexp p t)
(backward-char 1)
- (dolist (s (nreverse (geiser-syntax--read-list p)))
- (let ((sn (if (listp s) (car s) s)))
- (when (symbolp sn) (push sn ids)))))
+ (let ((s (car (geiser-syntax--read-list p))))
+ (when (symbolp s) (push s ids))))
(t (goto-char (1+ p))))))))
(nreverse ids)))))