(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.
(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)
(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)