summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2022-11-26 09:37:48 +0100
committerStefan Kangas <stefankangas@gmail.com>2022-11-26 09:37:48 +0100
commit30d4011b8a43f29cdda2eeea95cce17fa1435bf1 (patch)
tree07d95c6bd596b6b5d71eb75fb1856b3da6e87f8a
parent372f8c5bffd8c18c95900a1fb53eb992b8a493aa (diff)
downloademacs-30d4011b8a43f29cdda2eeea95cce17fa1435bf1.tar.gz
Use substitute-command-keys in Info-index error
* lisp/info.el (info--ensure-not-in-directory-node): New helper function using substitute-command-keys for error message. (Info-index, Info-virtual-index): Use it.
-rw-r--r--lisp/info.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 8860a664bd7..7d44a1cec1d 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3329,6 +3329,12 @@ If FILE is nil, check the current Info file."
(or node (error "No index"))
(Info-goto-node node)))
+(defun info--ensure-not-in-directory-node ()
+ (if (equal Info-current-file "dir")
+ (error (substitute-command-keys
+ (concat "The Info directory node has no index; "
+ "type \\[Info-menu] to select a manual")))))
+
;;;###autoload
(defun Info-index (topic)
"Look up a string TOPIC in the index for this manual and go to that entry.
@@ -3342,15 +3348,13 @@ Give an empty topic name to go to the Index node itself."
(Info-complete-menu-buffer (clone-buffer))
(Info-complete-nodes (Info-index-nodes))
(Info-history-list nil))
- (if (equal Info-current-file "dir")
- (error "The Info directory node has no index; use m to select a manual"))
+ (info--ensure-not-in-directory-node)
(unwind-protect
(with-current-buffer Info-complete-menu-buffer
(Info-goto-index)
(completing-read "Index topic: " #'Info-complete-menu-item))
(kill-buffer Info-complete-menu-buffer)))))
- (if (equal Info-current-file "dir")
- (error "The Info directory node has no index; use m to select a manual"))
+ (info--ensure-not-in-directory-node)
;; Strip leading colon in topic; index format does not allow them.
(if (and (stringp topic)
(> (length topic) 0)
@@ -3533,8 +3537,7 @@ search results."
(Info-complete-menu-buffer (clone-buffer))
(Info-complete-nodes (Info-index-nodes))
(Info-history-list nil))
- (if (equal Info-current-file "dir")
- (error "The Info directory node has no index; use m to select a manual"))
+ (info--ensure-not-in-directory-node)
(unwind-protect
(with-current-buffer Info-complete-menu-buffer
(Info-goto-index)