From 7233d6a9ece075140908b206dca14b6b4784be78 Mon Sep 17 00:00:00 2001
From: Paul Nelson <ultrono@gmail.com>
Date: Fri, 20 Sep 2024 16:48:02 +0200
Subject: [PATCH] Fix keybinding support for *-auto-reveal

* preview.el (preview-auto-reveal):
* tex-fold.el (TeX-fold-auto-reveal): Evaluate any keybindings
before calling *-arrived-via.
---
 preview.el  | 8 +++++++-
 tex-fold.el | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/preview.el b/preview.el
index d7603004..1d6b27ac 100644
--- a/preview.el
+++ b/preview.el
@@ -1654,7 +1654,13 @@ This list is consulted by the default value of `preview-auto-reveal'."
                          (sexp :tag "Key binding"))))
 
 (defcustom preview-auto-reveal
-  '(eval (apply #'preview-arrived-via preview-auto-reveal-commands))
+  '(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))
   "Cause previews to open automatically when entered.
 Possibilities are:
 t autoopens,
diff --git a/tex-fold.el b/tex-fold.el
index 8bf10be7..12f7c2f7 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -266,7 +266,13 @@ This list is consulted by the default value of `TeX-fold-auto-reveal'."
                          (sexp :tag "Key binding"))))
 
 (defcustom TeX-fold-auto-reveal
-  '(eval (apply #'TeX-fold-arrived-via TeX-fold-auto-reveal-commands))
+  '(eval . ((apply #'TeX-fold-arrived-via
+                   (mapcar (lambda (cmd)
+                             (if (and (listp cmd) (eq (car cmd) 'key-binding))
+                                 (eval cmd t)
+                               cmd))
+                           TeX-fold-auto-reveal-commands))
+            t))
   "Predicate to open a fold when entered.
 Possibilities are:
 t autoopens,
-- 
2.39.3 (Apple Git-145)

