summaryrefslogtreecommitdiff
path: root/lisp/info.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-12-05 14:14:11 +0800
committerChong Yidong <cyd@gnu.org>2012-12-05 14:14:11 +0800
commit04b14f2b275b064440ca8366cd5b7c4effcdac82 (patch)
treec20c99d5321e627f861f4370ba8a39655815e349 /lisp/info.el
parent066f0e09bc17809beeb6b6c20e3032d0f4420795 (diff)
downloademacs-04b14f2b275b064440ca8366cd5b7c4effcdac82.tar.gz
Improve completion behavior of info-display-manual.
* lisp/info.el (info-display-manual): Add existing Info buffers, whose files may not be in Info-directory-list, to the completion. (info--manual-names): New helper function.
Diffstat (limited to 'lisp/info.el')
-rw-r--r--lisp/info.el18
1 files changed, 15 insertions, 3 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 6149c3fcd80..2c2d485e245 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -5105,9 +5105,7 @@ Otherwise, visit the manual in a new Info buffer."
(progn
(info-initialize)
(completing-read "Manual name: "
- (apply-partially 'Info-read-node-name-2
- Info-directory-list
- (mapcar 'car Info-suffix-list))
+ (info--manual-names)
nil t))))
(let ((blist (buffer-list))
(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
@@ -5126,6 +5124,20 @@ Otherwise, visit the manual in a new Info buffer."
(info (Info-find-file manual)
(generate-new-buffer-name "*info*")))))
+(defun info--manual-names ()
+ (let (names)
+ (dolist (buffer (buffer-list))
+ (with-current-buffer buffer
+ (and (eq major-mode 'Info-mode)
+ (stringp Info-current-file)
+ (push (file-name-sans-extension
+ (file-name-nondirectory Info-current-file))
+ names))))
+ (delete-dups (append (nreverse names)
+ (apply-partially 'Info-read-node-name-2
+ Info-directory-list
+ (mapcar 'car Info-suffix-list))))))
+
(provide 'info)
;;; info.el ends here