GNU bug report logs -
#34233
27.0.50; defvar in comment
Previous Next
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
View this message in rfc822 format
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> 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. :-))
There is already a function for this particular case:
syntax-ppss-toplevel-pos.
This bug report was last modified 5 years and 337 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.