node name by putting it at the front, in parentheses. Thus,
@kbd{g(dir)Top@key{RET}} would go to the Info Directory node, which is
the node @samp{Top} in the Info file @file{dir}. Likewise,
-@kbd{g(emacs)Top@key{RET}} goes to the top node of the Emacs manual.
+@kbd{g(emacs)Top@key{RET}} (or just @kbd{g(emacs)@key{RET}}) goes to the
+top node of the Emacs manual.
The node name @samp{*} specifies the whole file. So you can look at
all of the current file by typing @kbd{g*@key{RET}} or all of any
If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file
FILENAME; otherwise, NODENAME should be in the current Info file (or one of
its sub-files).
-Completion is available, but only for node names in the current Info file.
+Completion is available for node names in the current Info file as well as
+in the Info file FILENAME after the closing parenthesis in (FILENAME).
+Empty NODENAME in (FILENAME) defaults to the Top node.
If FORK is non-nil (interactively with a prefix arg), show the node in
a new Info buffer.
If FORK is a string, it is the name to use for the new buffer."
((string-match "\\`(\\([^)]+\\))" string)
(let ((file0 (match-string 0 string))
(file1 (match-string 1 string))
- (node (substring string (match-end 0))))
- (completion-table-with-context
- file0
- (apply-partially
- (lambda (string pred action)
- (complete-with-action
- action
- (Info-build-node-completions (Info-find-file file1))
- string pred)))
- node predicate code)))
+ (nodename (substring string (match-end 0))))
+ (if (and (equal nodename "") (eq code 'lambda))
+ ;; Empty node name is permitted that means "Top".
+ t
+ (completion-table-with-context
+ file0
+ (apply-partially
+ (lambda (string pred action)
+ (complete-with-action
+ action
+ (Info-build-node-completions (Info-find-file file1))
+ string pred)))
+ nodename predicate code))))
;; Otherwise use Info-read-node-completion-table.
(t (complete-with-action
code Info-read-node-completion-table string predicate))))
(defun Info-read-node-name (prompt)
"Read an Info node name with completion, prompting with PROMPT.
A node name can have the form \"NODENAME\", referring to a node
-in the current Info file, or \"(FILENAME)NODENAME\"."
+in the current Info file, or \"(FILENAME)NODENAME\", referring to
+a node in FILENAME. \"(FILENAME)\" is a short format to go to
+the Top node in FILENAME."
(let* ((completion-ignore-case t)
(Info-read-node-completion-table (Info-build-node-completions))
(nodename (completing-read prompt 'Info-read-node-name-1 nil t)))
(Info-read-node-name prompt)
nodename)))
-(defun Info-build-node-completions (&optional file)
- (if file
- (or (cdr (assoc file Info-file-completions))
+(defun Info-build-node-completions (&optional filename)
+ (if filename
+ (or (cdr (assoc filename Info-file-completions))
(with-temp-buffer
(Info-mode)
- (Info-goto-node (format "(%s)Top" file))
+ (Info-goto-node (format "(%s)Top" filename))
(Info-build-node-completions-1)
- (push (cons file Info-current-file-completions) Info-file-completions)
+ (push (cons filename Info-current-file-completions) Info-file-completions)
Info-current-file-completions))
(or Info-current-file-completions
(Info-build-node-completions-1))))