[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10771: TAB completion for info-display-manual
From: |
Chong Yidong |
Subject: |
bug#10771: TAB completion for info-display-manual |
Date: |
Mon, 03 Dec 2012 14:57:14 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> At least this is not worse than the original command that reads a
>> manual name without completion.
>
> I didn't say it was worse. I asked how it was better.
How about adding existing Info buffers' manual names to the completion
table too, like the following?
=== modified file 'lisp/info.el'
*** lisp/info.el 2012-12-02 06:41:22 +0000
--- lisp/info.el 2012-12-03 06:55:15 +0000
***************
*** 5105,5113 ****
(progn
(info-initialize)
(completing-read "Manual name: "
! (apply-partially 'Info-read-node-name-2
! Info-directory-list
! (mapcar 'car Info-suffix-list))
nil t))))
(let ((blist (buffer-list))
(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
--- 5105,5111 ----
(progn
(info-initialize)
(completing-read "Manual name: "
! (info--manual-names)
nil t))))
(let ((blist (buffer-list))
(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
***************
*** 5126,5131 ****
--- 5124,5143 ----
(info (Info-find-file manual)
(generate-new-buffer-name "*info*")))))
+ (defun info--manual-names ()
+ (let (names)
+ (dolist (buffer (buffer-list))
+ (with-current-buffer buffer
+ (when (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 names
+ (apply-partially 'Info-read-node-name-2
+ Info-directory-list
+ (mapcar 'car Info-suffix-list))))))
+
(provide 'info)
;;; info.el ends here