GNU bug report logs - #34233
27.0.50; defvar in comment

Previous Next

Package: emacs;

Reported by: Sebastian Miele <sebastian.miele <at> gmail.com>

Date: Mon, 28 Jan 2019 12:04:01 UTC

Severity: normal

Tags: fixed

Found in version 27.0.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 34233 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 34233 <at> debbugs.gnu.org, Sebastian Miele <sebastian.miele <at> gmail.com>,
 Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#34233: 27.0.50; defvar in comment
Date: Wed, 10 Jul 2019 13:42:10 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> This is `eval-sexp-add-defvars' not checking if defvars are really code.

So is this the correct solution?

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index cb1b17b447..0e99cb9ac0 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1179,7 +1179,13 @@ eval-sexp-add-defvars
           (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.
+                          (null (nth 4 syntax))
+                          ;; Not in a string.
+                          (null (nth 3 syntax)))))
                  (push var vars))))
         `(progn ,@(mapcar (lambda (v) `(defvar ,v)) vars) ,exp)))))
 
(Those ppss things really should have accessors.  :-))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 5 years and 309 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.