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
commit2ddf2d2b920a00e4dfcdb37f54c96f3c918e0e14 (patch)
treee4adf72fdfdd87c62341588e40179cba7ad9a21b /elisp/geiser-syntax.el
parentcdc33372c0e98f7159831cce44d12d5400798307 (diff)
downloadgeiser-2ddf2d2b920a00e4dfcdb37f54c96f3c918e0e14.tar.gz
geiser-2ddf2d2b920a00e4dfcdb37f54c96f3c918e0e14.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)