emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master a87bdb8: Fix C-x C-e with defvars in comments prece


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master a87bdb8: Fix C-x C-e with defvars in comments preceding
Date: Thu, 11 Jul 2019 09:46:11 -0400 (EDT)

branch: master
commit a87bdb8f91263c3ebe1903b82b15cd148ab09da5
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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).
---
 lisp/progmodes/elisp-mode.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index cb1b17b..ae09bfc 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."
           (let ((var (intern (match-string 1))))
             (and (not (special-variable-p var))
                  (save-excursion
-                   (zerop (car (syntax-ppss (match-beginning 0)))))
+                   (let ((syntax (syntax-ppss (match-beginning 0))))
+                     ;; Top-level.
+                     (and (zerop (car syntax))
+                          ;; Not in a comment or string.
+                          (null (nth 8 syntax)))))
                  (push var vars))))
         `(progn ,@(mapcar (lambda (v) `(defvar ,v)) vars) ,exp)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]