diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-08-30 07:15:55 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-08-30 07:15:55 +0200 |
commit | b09474daeb892ef0293342839a379e34d4d7c048 (patch) | |
tree | cff2bfda7fadd09b8a142191b9b0184e9663c557 | |
parent | 627eef525aab39ba0895e120f0bca9be7fc10e6b (diff) | |
download | geiser-chez-b09474daeb892ef0293342839a379e34d4d7c048.tar.gz geiser-chez-b09474daeb892ef0293342839a379e34d4d7c048.tar.bz2 |
Fix for locals scanning in presence of rest arguments.
-rw-r--r-- | elisp/geiser-syntax.el | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el index 23f0ed3..e7c2a9f 100644 --- a/elisp/geiser-syntax.el +++ b/elisp/geiser-syntax.el @@ -247,27 +247,29 @@ (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))) - (cond ((or (null form) (not (listp form))) (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 (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 (eq (car f) 'define) (push (cadr f) locals))) + (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))) (geiser-syntax--scan-locals bfs sbfs - (car (last (or rest names))) - partial - locals)))))) + (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 (eq (car f) 'define) (push (cadr f) locals))) + (geiser-syntax--scan-locals bfs sbfs + (car (last (or rest names))) + partial + locals))))))) (defun geiser-syntax--locals-around-point (bfs sbfs) (when (eq major-mode 'scheme-mode) |