bug#79975: 14.1.0; void-function error in `preview-auto-reveal`

2025-12-10 Thread Arash Esbati
Hi Al,

Al Haji-Ali  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



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#79975: 14.1.0; void-function error in `preview-auto-reveal`

2025-12-10 Thread Al Haji-Ali
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



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#79975: 14.1.0; void-function error in `preview-auto-reveal`

2025-12-09 Thread Arash Esbati
Hi all,

Al Haji-Ali  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



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#79975: 14.1.0; void-function error in `preview-auto-reveal`

2025-12-09 Thread Al Haji-Ali

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



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#79975: 14.1.0; void-function error in `preview-auto-reveal`

2025-12-09 Thread David Kastrup
Al Haji-Ali  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



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#79975: 14.1.0; void-function error in `preview-auto-reveal`

2025-12-09 Thread Stefan Monnier via bug-auctex via Bug reporting list for AUCTeX
> 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




___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#79975: 14.1.0; void-function error in `preview-auto-reveal`

2025-12-09 Thread Al Haji-Ali

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



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex