From b09474daeb892ef0293342839a379e34d4d7c048 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 30 Aug 2010 07:15:55 +0200 Subject: Fix for locals scanning in presence of rest arguments. --- elisp/geiser-syntax.el | 42 ++++++++++++++++++++++-------------------- 1 file 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) -- cgit v1.2.3