GNU bug report logs - #79975
14.1.0; void-function error in `preview-auto-reveal`

Previous Next

Package: auctex;

Reported by: Al Haji-Ali <abdo.haji.ali <at> gmail.com>

Date: Tue, 9 Dec 2025 11:11:01 UTC

Severity: normal

Found in version 14.1.0

Done: Arash Esbati <arash <at> gnu.org>

To reply to this bug, email your comments to 79975 AT debbugs.gnu.org.
There is no need to reopen the bug first.

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-auctex <at> gnu.org:
bug#79975; Package auctex. (Tue, 09 Dec 2025 11:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Al Haji-Ali <abdo.haji.ali <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Tue, 09 Dec 2025 11:11:02 GMT) Full text and rfc822 format available.

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

From: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
To: bug-auctex <at> gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: 14.1.0; void-function error in `preview-auto-reveal`
Date: Tue, 09 Dec 2025 11:58:25 +0100
I am getting the error `(void-function closure)` on Emacs 29.4 (but not
on 31.0.50 FWIW) when the default value of the function
`preview-auto-reveal` is executed. I am able to reproduce the error on
Emacs 29.4 with this

(require 'preview)
(apply preview-auto-reveal)

*IF* the preview.el file is not compiled. I can also reproduce the error
 (assuming lexical-binding is t) by using its default value:

(apply `(eval . ((apply #'preview-arrived-via
                   (mapcar ,(lambda (cmd)
                              (if (and (listp cmd) (eq (car cmd) 'key-binding))
                                  (eval cmd t)
                                cmd))
                           preview-auto-reveal-commands))
            t)))

or simply with the stripped down version:

(apply `(eval . ((apply #'ignore (mapcar ,(lambda (cmd) nil) nil)) t)))


Removing `,` before the (lambda ...) fixes the error, but I am not sure
why it was there in the first place.

-- Al




Information forwarded to bug-auctex <at> gnu.org:
bug#79975; Package auctex. (Tue, 09 Dec 2025 12:33:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Cc: bug-auctex <at> gnu.org
Subject: Re: 14.1.0; void-function error in `preview-auto-reveal`
Date: Tue, 09 Dec 2025 07:31:45 -0500
> I am getting the error `(void-function closure)` on Emacs 29.4 (but not
[...]
> (apply `(eval . ((apply #'preview-arrived-via
>                    (mapcar ,(lambda (cmd)
>                               (if (and (listp cmd) (eq (car cmd) 'key-binding))
>                                   (eval cmd t)
>                                 cmd))
>                            preview-auto-reveal-commands))
>             t)))

Indeed, in Emacs<30, function values are not always self-quoting, so you
need a quote before the comma.
[ note: the problem should disappear if you compile the file, because
  compiled function values *are* self-quoting even in Emacs<30.  ]


        Stefan





Information forwarded to bug-auctex <at> gnu.org:
bug#79975; Package auctex. (Tue, 09 Dec 2025 12:34:02 GMT) Full text and rfc822 format available.

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

From: David Kastrup <dak <at> gnu.org>
To: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Cc: 79975 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#79975: 14.1.0; void-function error in `preview-auto-reveal`
Date: Tue, 09 Dec 2025 13:33:28 +0100
Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:

> I am getting the error `(void-function closure)` on Emacs 29.4 (but not
> on 31.0.50 FWIW) when the default value of the function
> `preview-auto-reveal` is executed. I am able to reproduce the error on
> Emacs 29.4 with this
>
> (require 'preview)
> (apply preview-auto-reveal)
>
> *IF* the preview.el file is not compiled. I can also reproduce the error
>  (assuming lexical-binding is t) by using its default value:
>
> (apply `(eval . ((apply #'preview-arrived-via
>                    (mapcar ,(lambda (cmd)
>                               (if (and (listp cmd) (eq (car cmd) 'key-binding))
>                                   (eval cmd t)
>                                 cmd))
>                            preview-auto-reveal-commands))
>             t)))
>
> or simply with the stripped down version:
>
> (apply `(eval . ((apply #'ignore (mapcar ,(lambda (cmd) nil) nil)) t)))
>
>
> Removing `,` before the (lambda ...) fixes the error, but I am not sure
> why it was there in the first place.

To create a closure at the point where the function is being written.
Maybe 29.4 has a problem with the function cell/data cell retainment in
this expression?

Does preceding ,(lambda ...) with #' help?  That would add a
function-quote around the finished closure.  Which should really not do
anything in this context, but then we should not be getting this error
in the first place.

-- 
David Kastrup




Information forwarded to bug-auctex <at> gnu.org:
bug#79975; Package auctex. (Tue, 09 Dec 2025 14:51:02 GMT) Full text and rfc822 format available.

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

From: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
To: David Kastrup <dak <at> gnu.org>
Cc: 79975 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#79975: 14.1.0; void-function error in `preview-auto-reveal`
Date: Tue, 09 Dec 2025 15:38:25 +0100
On 09/12/2025, David Kastrup wrote:
> Does preceding ,(lambda ...) with #' help?  That would add a
> function-quote around the finished closure.  Which should really not do
> anything in this context, but then we should not be getting this error
> in the first place.

Yes indeed. Adding ' or #' before the comma resolves the issue on Emacs
29.4. It also doesn't break Emacs 31.0.50, even though 

`(eval . ((apply #'ignore (mapcar #',(lambda (cmd) nil) nil)) t))

produces an additional quote on Emacs 31.0.50, as in:

(eval (apply #'ignore (mapcar #'#[(cmd) (nil) (t)] nil)) t)

compared to.
`(eval . ((apply #'ignore (mapcar ,(lambda (cmd) nil) nil)) t))

which gives
(eval (apply #'ignore (mapcar #[(cmd) (nil) (t)] nil)) t)

Can someone with write access to AUCTeX make this change to
`preview-auto-reveal`?

-- Al




Information forwarded to bug-auctex <at> gnu.org:
bug#79975; Package auctex. (Wed, 10 Dec 2025 07:29:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Cc: 79975 <at> debbugs.gnu.org, David Kastrup <dak <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#79975: 14.1.0; void-function error in `preview-auto-reveal`
Date: Wed, 10 Dec 2025 08:28:18 +0100
Hi all,

Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:

> Can someone with write access to AUCTeX make this change to
> `preview-auto-reveal`?

Are you thinking about something like this:

--8<---------------cut here---------------start------------->8---
diff --git a/preview.el b/preview.el
index 94812886..8b757c84 100644
--- a/preview.el
+++ b/preview.el
@@ -1746,10 +1746,12 @@ This list is consulted by the default value of `preview-auto-reveal'."

 (defcustom preview-auto-reveal
   `(eval . ((apply #'preview-arrived-via
-                   (mapcar ,(lambda (cmd)
-                              (if (and (listp cmd) (eq (car cmd) 'key-binding))
-                                  (eval cmd t)
-                                cmd))
+                   ;; Quote the function value for interpreted code in
+                   ;; Emacs<30 (bug#79975):
+                   (mapcar #',(lambda (cmd)
+                                (if (and (listp cmd) (eq (car cmd) 'key-binding))
+                                    (eval cmd t)
+                                  cmd))
                            preview-auto-reveal-commands))
             t))
   "Cause previews to open automatically when entered.
--8<---------------cut here---------------end--------------->8---

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#79975; Package auctex. (Wed, 10 Dec 2025 08:31:03 GMT) Full text and rfc822 format available.

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

From: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
To: Arash Esbati <arash <at> gnu.org>
Cc: 79975 <at> debbugs.gnu.org, David Kastrup <dak <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#79975: 14.1.0; void-function error in `preview-auto-reveal`
Date: Wed, 10 Dec 2025 09:18:51 +0100
Hello Arash,


On 10/12/2025, Arash Esbati wrote:
> Are you thinking about something like this:

Yes exactly. Assuming it does not break anything in Emacs >30 (I am not
experienced enough with self-quoting expressions to judge).

Best regards,
-- Al




Reply sent to Arash Esbati <arash <at> gnu.org>:
You have taken responsibility. (Wed, 10 Dec 2025 08:50:03 GMT) Full text and rfc822 format available.

Notification sent to Al Haji-Ali <abdo.haji.ali <at> gmail.com>:
bug acknowledged by developer. (Wed, 10 Dec 2025 08:50:03 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Cc: 79975-done <at> debbugs.gnu.org, David Kastrup <dak <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#79975: 14.1.0; void-function error in `preview-auto-reveal`
Date: Wed, 10 Dec 2025 09:49:37 +0100
Hi Al,

Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:

> Yes exactly.

Thanks, and pushed.

> Assuming it does not break anything in Emacs >30 (I am not experienced
> enough with self-quoting expressions to judge).

I trust Stefan's and your judgement in this case.  But we can revisit
this if people on Emacs>30 complain.  I'm closing this report for now.

Best, Arash




This bug report was last modified today.

Previous Next


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