summaryrefslogtreecommitdiff
path: root/elisp/geiser-syntax.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-06 00:53:07 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-06 00:53:07 +0200
commit8170fdab0cf35cf12d1dc091b6232ac4d22fe1a5 (patch)
tree89dbd8bce912052d93ba4855a3c9307727960a75 /elisp/geiser-syntax.el
parent2b0ff9f520839d7389ddb9e2354c709a1ce401d4 (diff)
downloadgeiser-chez-8170fdab0cf35cf12d1dc091b6232ac4d22fe1a5.tar.gz
geiser-chez-8170fdab0cf35cf12d1dc091b6232ac4d22fe1a5.tar.bz2
Use cl only at compile time
Diffstat (limited to 'elisp/geiser-syntax.el')
-rw-r--r--elisp/geiser-syntax.el57
1 files changed, 31 insertions, 26 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index 551ee6a..ae6c072 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -17,6 +17,8 @@
(require 'scheme)
+(eval-when-compile (require 'cl))
+
;;; Indentation:
@@ -248,34 +250,37 @@
(defsubst geiser-syntax--binding-form*-p (sbfs f)
(or (eq 'let* f) (memq f sbfs)))
+(defsubst geiser-syntax--if-symbol (x) (and (symbolp x) x))
+(defsubst geiser-syntax--if-list (x) (and (listp x) x))
+(defsubst geiser-syntax--normalize (vars)
+ (mapcar (lambda (i) (if (listp i) (car i) i)) vars))
+
(defun geiser-syntax--scan-locals (bfs sbfs form partial locals)
- (flet ((if-symbol (x) (and (symbolp x) x))
- (if-list (x) (and (listp x) x))
- (normalize (vars) (mapcar (lambda (i) (if (listp i) (car i) i)) vars)))
- (let ((form (if (listp form) (normalize form) form)))
- (cond ((or (null form) (not (listp form))) (normalize locals))
- ((not (geiser-syntax--binding-form-p bfs sbfs (car form)))
+ (let ((form (if (listp form) (geiser-syntax--normalize form) form)))
+ (cond ((or (null form) (not (listp form)))
+ (geiser-syntax--normalize locals))
+ ((not (geiser-syntax--binding-form-p bfs sbfs (car form)))
+ (geiser-syntax--scan-locals bfs sbfs
+ (car (last form)) partial locals))
+ (t
+ (let* ((head (car form))
+ (name (geiser-syntax--if-symbol (cadr form)))
+ (names (if name (geiser-syntax--if-list (caddr form))
+ (geiser-syntax--if-list (cadr form))))
+ (rest (if name (cdddr form) (cddr form)))
+ (use-names (or rest
+ (not partial)
+ (geiser-syntax--binding-form*-p sbfs
+ head))))
+ (when name (push name locals))
+ (when use-names (dolist (n names) (push n locals)))
+ (dolist (f (butlast rest))
+ (when (and (listp f) (eq (car f) 'define))
+ (push (cadr f) locals)))
(geiser-syntax--scan-locals bfs sbfs
- (car (last form)) partial locals))
- (t
- (let* ((head (car form))
- (name (if-symbol (cadr form)))
- (names (if name (if-list (caddr form))
- (if-list (cadr form))))
- (rest (if name (cdddr form) (cddr form)))
- (use-names (or rest
- (not partial)
- (geiser-syntax--binding-form*-p sbfs
- head))))
- (when name (push name locals))
- (when use-names (dolist (n names) (push n locals)))
- (dolist (f (butlast rest))
- (when (and (listp f) (eq (car f) 'define))
- (push (cadr f) locals)))
- (geiser-syntax--scan-locals bfs sbfs
- (car (last (or rest names)))
- partial
- locals)))))))
+ (car (last (or rest names)))
+ partial
+ locals))))))
(defun geiser-syntax--locals-around-point (bfs sbfs)
(when (eq major-mode 'scheme-mode)