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.
This commit is contained in:
parent
372f8c5bff
commit
30d4011b8a
1 changed files with 9 additions and 6 deletions
15
lisp/info.el
15
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue