bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#34233: 27.0.50; defvar in comment


From: Michael Heerdegen
Subject: bug#34233: 27.0.50; defvar in comment
Date: Wed, 10 Jul 2019 23:17:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Lars Ingebrigtsen <address@hidden> writes:

> 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)))))

Yes, I think so, plus Noam's suggestion.

Michael.





reply via email to

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