From 10fff83762262ec4d5f571e26069d37162ba514d Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 14 Oct 2014 21:56:56 -0400 Subject: [PATCH] * lisp/progmodes/elisp-mode.el (elisp--local-variables-1): Handle quoted expressions. Fixes: debbugs:18688 --- lisp/ChangeLog | 5 +++++ lisp/progmodes/elisp-mode.el | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 055ec17160e..f092ec6b539 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-10-15 Stefan Monnier + + * progmodes/elisp-mode.el (elisp--local-variables-1): + Handle quoted expressions (bug#18688). + 2014-10-14 Jérémy Compostella Michael Albinus diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index f3143bd76ee..900e859b54a 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -255,18 +255,27 @@ Blank lines separate paragraphs. Semicolons start comments. (dolist (binding bindings) (push (or (car-safe binding) binding) vars)) (elisp--local-variables-1 vars (car (last body))))) - (`(lambda ,_) (setq sexp nil)) + (`(lambda ,_args) + ;; FIXME: Look for the witness inside `args'. + (setq sexp nil)) (`(lambda ,args . ,body) (elisp--local-variables-1 - (append args vars) (car (last body)))) + (append (remq '&optional (remq '&rest args)) vars) + (car (last body)))) (`(condition-case ,_ ,e) (elisp--local-variables-1 vars e)) (`(condition-case ,v ,_ . ,catches) (elisp--local-variables-1 (cons v vars) (cdr (car (last catches))))) + (`(quote . ,_) + ;; FIXME: Look for the witness inside sexp. + (setq sexp nil)) + ;; FIXME: Handle `cond'. (`(,_ . ,_) (elisp--local-variables-1 vars (car (last sexp)))) (`elisp--witness--lisp (or vars '(nil))) (_ nil))) + ;; We didn't find the witness in the last element so we try to + ;; backtrack to the last-but-one. (setq sexp (ignore-errors (butlast sexp))))) res)) -- 2.39.5