unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57065: 29.0.50; Double evaluation in `c-make-no-parens-syntax-table`
@ 2022-08-09  7:53 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-08-09 18:29 ` Lars Ingebrigtsen
  2022-08-25 21:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-09  7:53 UTC (permalink / raw)
  To: 57065

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)






^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#57065: 29.0.50; Double evaluation in `c-make-no-parens-syntax-table`
  2022-08-09  7:53 bug#57065: 29.0.50; Double evaluation in `c-make-no-parens-syntax-table` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-08-09 18:29 ` Lars Ingebrigtsen
  2022-08-25 21:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-09 18:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 57065, Alan Mackenzie

Stefan Monnier <monnier@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#57065: 29.0.50; Double evaluation in `c-make-no-parens-syntax-table`
  2022-08-09  7:53 bug#57065: 29.0.50; Double evaluation in `c-make-no-parens-syntax-table` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-08-09 18:29 ` Lars Ingebrigtsen
@ 2022-08-25 21:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-08-27  9:46   ` Alan Mackenzie
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-25 21:00 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 57065-done

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)






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#57065: 29.0.50; Double evaluation in `c-make-no-parens-syntax-table`
  2022-08-25 21:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-08-27  9:46   ` Alan Mackenzie
  2022-08-27 15:11     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2022-08-27  9:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 57065

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)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#57065: 29.0.50; Double evaluation in `c-make-no-parens-syntax-table`
  2022-08-27  9:46   ` Alan Mackenzie
@ 2022-08-27 15:11     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-27 15:11 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 57065

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






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-27 15:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-09  7:53 bug#57065: 29.0.50; Double evaluation in `c-make-no-parens-syntax-table` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-09 18:29 ` Lars Ingebrigtsen
2022-08-25 21:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-27  9:46   ` Alan Mackenzie
2022-08-27 15:11     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).