aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov <[email protected]>2013-01-08 02:11:51 +0200
committerJuri Linkov <[email protected]>2013-01-08 02:11:51 +0200
commitc6a22ce23dad655c84f95bad1ed5191c2682f74e (patch)
tree0f7172911cee10b0c86a2fe53a8cc5874ffe2c2b
parentacfe10b71c260718f72445cd984327c1d96063ab (diff)
* lisp/info.el (Info-read-node-name-1): Allow empty node name in (FILENAME)
that defaults to the Top node. (Info-goto-node, Info-read-node-name): Doc fix to mention that the short format (FILENAME) goes to the Top node. (Info-build-node-completions): Rename arg `file' to `filename'. * doc/misc/info.texi (Go to node): Mention the abbreviated format `(FILENAME)' equal to `(FILENAME)Top'. Fixes: debbugs:13365
-rw-r--r--doc/misc/ChangeLog5
-rw-r--r--doc/misc/info.texi3
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/info.el41
4 files changed, 40 insertions, 18 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 79214acc10..91a328198a 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-08 Juri Linkov <[email protected]>
+
+ * info.texi (Go to node): Mention the abbreviated format
+ `(FILENAME)' equal to `(FILENAME)Top'. (Bug#13365)
+
2013-01-06 Andreas Schwab <[email protected]>
* autotype.texi: Remove undefined command @subtitlefont.
diff --git a/doc/misc/info.texi b/doc/misc/info.texi
index 70dfffde39..d17a65571f 100644
--- a/doc/misc/info.texi
+++ b/doc/misc/info.texi
@@ -1079,7 +1079,8 @@ partial node name.
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
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 185bf74bc0..9b30294e65 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2013-01-08 Juri Linkov <[email protected]>
+
+ * info.el (Info-read-node-name-1): Allow empty node name in (FILENAME)
+ that defaults to the Top node.
+ (Info-goto-node, Info-read-node-name): Doc fix to mention that
+ the short format (FILENAME) goes to the Top node.
+ (Info-build-node-completions): Rename arg `file' to `filename'.
+ (Bug#13365)
+
2013-01-07 Bastien Guerry <[email protected]>
* menu-bar.el (menu-bar-search-documentation-menu): Use
diff --git a/lisp/info.el b/lisp/info.el
index 8408e01efb..9bce39a6d3 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1703,7 +1703,9 @@ escaped (\\\",\\\\)."
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."
@@ -1784,16 +1786,19 @@ See `completing-read' for a description of arguments and usage."
((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))))
@@ -1802,7 +1807,9 @@ See `completing-read' for a description of arguments and usage."
(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)))
@@ -1810,14 +1817,14 @@ in the current Info file, or \"(FILENAME)NODENAME\"."
(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))))