[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 30d4011b8a: Use substitute-command-keys in Info-index error
From: |
Stefan Kangas |
Subject: |
master 30d4011b8a: Use substitute-command-keys in Info-index error |
Date: |
Sat, 26 Nov 2022 03:40:26 -0500 (EST) |
branch: master
commit 30d4011b8a43f29cdda2eeea95cce17fa1435bf1
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>
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.
---
lisp/info.el | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lisp/info.el b/lisp/info.el
index 8860a664bd..7d44a1cec1 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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 30d4011b8a: Use substitute-command-keys in Info-index error,
Stefan Kangas <=