GNU bug report logs - #57065
29.0.50; Double evaluation in `c-make-no-parens-syntax-table`

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Tue, 9 Aug 2022 07:55:02 UTC

Severity: normal

Found in version 29.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57065 in the body.
You can then email your comments to 57065 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#57065; Package emacs. (Tue, 09 Aug 2022 07:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 09 Aug 2022 07:55:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Double evaluation in `c-make-no-parens-syntax-table`
Date: Tue, 09 Aug 2022 03:53:53 -0400
Package: Emacs
Version: 29.0.50


The patch below seems to be necessary to avoid a double-evaluation.
This can be seen if you do something like

    (c-lang-defconst c-make-mode-syntax-table my-lang #'my-fun)

or

    (c-lang-defconst c-make-mode-syntax-table my-lang (symbol-value 'my-fun))

or

    (c-lang-defconst c-make-mode-syntax-table my-lang
      (lambda () ..))

where you'll get errors like "void-variable `my-fun`" or "void-function
`closure`.


        Stefan


diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index c5964165c8d..7826f38ca1a 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -403,7 +403,7 @@ c-make-no-parens-syntax-table
   t  (if (c-lang-const c-recognize-<>-arglists)
      `(lambda ()
 	;(if (c-lang-const c-recognize-<>-arglists)
-	(let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
+	(let ((table (funcall ',(c-lang-const c-make-mode-syntax-table))))
 	  (modify-syntax-entry ?\( "." table)
 	  (modify-syntax-entry ?\) "." table)
 	  (modify-syntax-entry ?\[ "." table)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57065; Package emacs. (Tue, 09 Aug 2022 18:30:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 57065 <at> debbugs.gnu.org, Alan Mackenzie <acm <at> muc.de>
Subject: Re: bug#57065: 29.0.50; Double evaluation in
 `c-make-no-parens-syntax-table`
Date: Tue, 09 Aug 2022 20:29:27 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> The patch below seems to be necessary to avoid a double-evaluation.
> This can be seen if you do something like
>
>     (c-lang-defconst c-make-mode-syntax-table my-lang #'my-fun)
>
> or
>
>     (c-lang-defconst c-make-mode-syntax-table my-lang (symbol-value 'my-fun))
>
> or
>
>     (c-lang-defconst c-make-mode-syntax-table my-lang
>       (lambda () ..))
>
> where you'll get errors like "void-variable `my-fun`" or "void-function
> `closure`.

Perhaps Alan has some comments; added to the CCs.




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Thu, 25 Aug 2022 21:02:02 GMT) Full text and rfc822 format available.

Notification sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
bug acknowledged by developer. (Thu, 25 Aug 2022 21:02:02 GMT) Full text and rfc822 format available.

Message #13 received at 57065-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 57065-done <at> debbugs.gnu.org
Subject: Re: bug#57065: 29.0.50; Double evaluation in
 `c-make-no-parens-syntax-table`
Date: Thu, 25 Aug 2022 17:00:56 -0400
Pushed to `master`, closing,


        Stefan


Stefan Monnier [2022-08-09 03:53:53] wrote:
> The patch below seems to be necessary to avoid a double-evaluation.
> This can be seen if you do something like
>
>     (c-lang-defconst c-make-mode-syntax-table my-lang #'my-fun)
>
> or
>
>     (c-lang-defconst c-make-mode-syntax-table my-lang (symbol-value 'my-fun))
>
> or
>
>     (c-lang-defconst c-make-mode-syntax-table my-lang
>       (lambda () ..))
>
> where you'll get errors like "void-variable `my-fun`" or "void-function
> `closure`.
>
>
>         Stefan
>
>
> diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
> index c5964165c8d..7826f38ca1a 100644
> --- a/lisp/progmodes/cc-langs.el
> +++ b/lisp/progmodes/cc-langs.el
> @@ -403,7 +403,7 @@ c-make-no-parens-syntax-table
>    t  (if (c-lang-const c-recognize-<>-arglists)
>       `(lambda ()
>  	;(if (c-lang-const c-recognize-<>-arglists)
> -	(let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
> +	(let ((table (funcall ',(c-lang-const c-make-mode-syntax-table))))
>  	  (modify-syntax-entry ?\( "." table)
>  	  (modify-syntax-entry ?\) "." table)
>  	  (modify-syntax-entry ?\[ "." table)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57065; Package emacs. (Sat, 27 Aug 2022 09:47:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 57065 <at> debbugs.gnu.org
Subject: Re: bug#57065: 29.0.50; Double evaluation in
 `c-make-no-parens-syntax-table`
Date: Sat, 27 Aug 2022 09:46:05 +0000
Hello, Stefan.

Thanks for debugging and fixing this.

There was another instance of the same bug in cc-langs.el, so I've fixed
that in a followup commit, even though that was unlikely to cause any
problems.

Of course, both fixes have gone into the upstream version.

Thanks again!

-- 
Alan Mackenzie (Nuremberg, Germany).



On Thu, Aug 25, 2022 at 17:00:56 -0400, Stefan Monnier wrote:
> Pushed to `master`, closing,


>         Stefan


> Stefan Monnier [2022-08-09 03:53:53] wrote:
> > The patch below seems to be necessary to avoid a double-evaluation.
> > This can be seen if you do something like

> >     (c-lang-defconst c-make-mode-syntax-table my-lang #'my-fun)

> > or

> >     (c-lang-defconst c-make-mode-syntax-table my-lang (symbol-value 'my-fun))

> > or

> >     (c-lang-defconst c-make-mode-syntax-table my-lang
> >       (lambda () ..))

> > where you'll get errors like "void-variable `my-fun`" or "void-function
> > `closure`.


> >         Stefan


> > diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
> > index c5964165c8d..7826f38ca1a 100644
> > --- a/lisp/progmodes/cc-langs.el
> > +++ b/lisp/progmodes/cc-langs.el
> > @@ -403,7 +403,7 @@ c-make-no-parens-syntax-table
> >    t  (if (c-lang-const c-recognize-<>-arglists)
> >       `(lambda ()
> >  	;(if (c-lang-const c-recognize-<>-arglists)
> > -	(let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
> > +	(let ((table (funcall ',(c-lang-const c-make-mode-syntax-table))))
> >  	  (modify-syntax-entry ?\( "." table)
> >  	  (modify-syntax-entry ?\) "." table)
> >  	  (modify-syntax-entry ?\[ "." table)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57065; Package emacs. (Sat, 27 Aug 2022 15:12:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 57065 <at> debbugs.gnu.org
Subject: Re: bug#57065: 29.0.50; Double evaluation in
 `c-make-no-parens-syntax-table`
Date: Sat, 27 Aug 2022 11:11:41 -0400
Alan Mackenzie [2022-08-27 09:46:05] wrote:
> There was another instance of the same bug in cc-langs.el, so I've fixed
> that in a followup commit,

Thanks.  Tho using #' to quote a function *value* is generally wrong (a
function value can be a bytecode object, a subr, a list of the form
(closure ...) none of which the compiler would be happy to see inside
a #', tho I suspect it may still end up doing what we need).

> even though that was unlikely to cause any problems.

Indeed.  For `c-make-no-parens-syntax-table` it did show up in
csharp-mode (that's how I ended up finding it).


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 25 Sep 2022 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 207 days ago.

Previous Next


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