diff options
author | Juri Linkov <juri@jurta.org> | 2013-01-08 02:11:51 +0200 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2013-01-08 02:11:51 +0200 |
commit | c6a22ce23dad655c84f95bad1ed5191c2682f74e (patch) | |
tree | 0f7172911cee10b0c86a2fe53a8cc5874ffe2c2b /lisp | |
parent | acfe10b71c260718f72445cd984327c1d96063ab (diff) | |
download | emacs-c6a22ce23dad655c84f95bad1ed5191c2682f74e.tar.gz |
* 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
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 9 | ||||
-rw-r--r-- | lisp/info.el | 41 |
2 files changed, 33 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 185bf74bc05..9b30294e65a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2013-01-08 Juri Linkov <juri@jurta.org> + + * 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 <bzg@gnu.org> * menu-bar.el (menu-bar-search-documentation-menu): Use diff --git a/lisp/info.el b/lisp/info.el index 8408e01efb5..9bce39a6d3a 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)))) |