aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-07-11 15:42:13 +0200
committerLars Ingebrigtsen2019-07-11 15:46:06 +0200
commita87bdb8f91263c3ebe1903b82b15cd148ab09da5 (patch)
treea51d1cd7a8925049ed53a3fc78e9be63f017ad7a
parent60fc771ac6f090e4e44339cb6d0232a852580ee2 (diff)
downloademacs-a87bdb8f91263c3ebe1903b82b15cd148ab09da5.tar.gz
emacs-a87bdb8f91263c3ebe1903b82b15cd148ab09da5.zip
Fix C-x C-e with defvars in comments preceding
* lisp/progmodes/elisp-mode.el (eval-sexp-add-defvars): When collecting defvars in the current buffer, ignore the ones that are in comments or strings (bug#34233).
-rw-r--r--lisp/progmodes/elisp-mode.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index cb1b17b4474..ae09bfc0224 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1179,7 +1179,11 @@ POS specifies the starting position where EXP was found and defaults to point."
1179 (let ((var (intern (match-string 1)))) 1179 (let ((var (intern (match-string 1))))
1180 (and (not (special-variable-p var)) 1180 (and (not (special-variable-p var))
1181 (save-excursion 1181 (save-excursion
1182 (zerop (car (syntax-ppss (match-beginning 0))))) 1182 (let ((syntax (syntax-ppss (match-beginning 0))))
1183 ;; Top-level.
1184 (and (zerop (car syntax))
1185 ;; Not in a comment or string.
1186 (null (nth 8 syntax)))))
1183 (push var vars)))) 1187 (push var vars))))
1184 `(progn ,@(mapcar (lambda (v) `(defvar ,v)) vars) ,exp))))) 1188 `(progn ,@(mapcar (lambda (v) `(defvar ,v)) vars) ,exp)))))
1185 1189