From 5623675a19043f6259d047946235667bc9cbeff1 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  | 7 ++++++-
 tex-fold.el | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/preview.el b/preview.el
index d7603004..3d5187bb 100644
--- a/preview.el
+++ b/preview.el
@@ -1654,7 +1654,12 @@ 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)
+                            cmd))
+                        preview-auto-reveal-commands)))
   "Cause previews to open automatically when entered.
 Possibilities are:
 t autoopens,
diff --git a/tex-fold.el b/tex-fold.el
index 8bf10be7..f1aaf1ac 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -266,7 +266,12 @@ 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)
+                            cmd))
+                        TeX-fold-auto-reveal-commands)))
   "Predicate to open a fold when entered.
 Possibilities are:
 t autoopens,
-- 
2.39.3 (Apple Git-145)

