Ihor Radchenko <yanta...@gmail.com> writes:

> I think that the most thorough way to add this feature is following
> what `help--key-description-fontified' does (we should not call this
> internal function though): [...]

How about the attached patch?

Rudy

>From edc5dde6d3a68e15491a0273d283e38482e6390e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salu...@me.com>
Date: Fri, 7 Oct 2022 17:05:15 +0200
Subject: [PATCH] org-export: Propertize keybindings in Org Export dispatch UI

* lisp/ox.el (org-export--dispatch-ui): Propertize the navigational
keybindings.
---
 lisp/ox.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index e059983fb..6089a575b 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -7123,8 +7123,20 @@ back to standard interface."
 	(delete-other-windows)
 	(org-switch-to-buffer-other-window
 	 (get-buffer-create "*Org Export Dispatcher*"))
-	(setq cursor-type nil
-	      header-line-format "Use SPC, DEL, C-n or C-p to navigate.")
+        (setq cursor-type nil)
+        (setq header-line-format
+              (let ((propertize-help-key
+                     (lambda (key)
+                       ;; Add `face' *and* `font-lock-face' to "work
+                       ;; reliably in any buffer", per a comment in
+                       ;; `help--key-description-fontified'.
+                       (propertize key
+                                   'font-lock-face 'help-key-binding
+                                   'face 'help-key-binding))))
+                (apply 'format
+                       (cons "Use %s, %s, %s, or %s to navigate."
+                             (mapcar propertize-help-key
+                                     (list "SPC" "DEL" "C-n" "C-p"))))))
 	;; Make sure that invisible cursor will not highlight square
 	;; brackets.
 	(set-syntax-table (copy-syntax-table))
-- 
2.38.0

-- 
"One can begin to reason only when a clear picture has been formed in
the imagination."
-- Walter Warwick Sawyer, Mathematician's Delight, 1943

Rudolf Adamkovič <salu...@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia

Reply via email to