From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump) Date: Sat, 29 Dec 2012 23:59:47 +0200 Organization: JURTA Message-ID: <87vcbkzf9d.fsf@mail.jurta.org> References: <83sjaf26jt.fsf@gnu.org> <83boh31lrj.fsf@gnu.org> <87a9wn85fa.fsf@mail.jurta.org> <87mwxfl4dl.fsf@mail.jurta.org> <87k3s3grbp.fsf@mail.jurta.org> <87bodfgntf.fsf@mail.jurta.org> <87han51zx8.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1356819666 21916 80.91.229.3 (29 Dec 2012 22:21:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Dec 2012 22:21:06 +0000 (UTC) Cc: 12456@debbugs.gnu.org To: Dani Moncayo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 29 23:21:22 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tp4mP-0007eM-Rw for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Dec 2012 23:21:22 +0100 Original-Received: from localhost ([::1]:56708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp4mA-00088K-Sw for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Dec 2012 17:21:06 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp4m8-00088F-8D for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 17:21:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tp4m7-000391-4G for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 17:21:04 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54410) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp4m7-00038x-0l for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 17:21:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Tp4n4-00036O-Pr for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 17:22:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Dec 2012 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12456 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12456-submit@debbugs.gnu.org id=B12456.135681967311853 (code B ref 12456); Sat, 29 Dec 2012 22:22:02 +0000 Original-Received: (at 12456) by debbugs.gnu.org; 29 Dec 2012 22:21:13 +0000 Original-Received: from localhost ([127.0.0.1]:36428 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tp4mG-000357-FY for submit@debbugs.gnu.org; Sat, 29 Dec 2012 17:21:13 -0500 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:48656 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tp4m3-00034O-6v for 12456@debbugs.gnu.org; Sat, 29 Dec 2012 17:21:01 -0500 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 64B8C451CE1E; Sat, 29 Dec 2012 14:19:57 -0800 (PST) In-Reply-To: (Dani Moncayo's message of "Sat, 29 Dec 2012 01:24:35 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:69173 Archived-At: > Yes, I don't see the point of duplicating each available info manual. > So I consider that a bug, and I'd be glad if it was fixed. Duplicating each available info manual might be useful for something since it is intentionally implemented this way, but at least we could fix the case like `g ( e l i TAB' where there is just one completion candidate, so TAB will complete it without suffix and add the closing paren. Also this patch fixes another problem with `Info-read-node-name-2' in `info-display-manual' where I noticed that `M-x info-display-manual RET TAB' displays a completion list like Possible completions are: &rest apply closure elisp when there are opened Info manuals. This problem is caused by appending a list of opened manual names to a closure. To fix this, a closure could be expanded to the list of available manual names with (all-completions "" (apply-partially ...) Another problem is that if an Info manual is opened in a temporary buffer with the leading space in the buffer name, it should skip such buffers with (not (string= (substring (buffer-name) 0 1) " ")) === modified file 'lisp/info.el' --- lisp/info.el 2012-12-28 22:07:07 +0000 +++ lisp/info.el 2012-12-29 21:59:36 +0000 @@ -1744,6 +1744,7 @@ (defun Info-read-node-name-2 (dirs suffi (when (file-name-absolute-p string) (setq dirs (list (file-name-directory string)))) (let ((names nil) + (names-sans-suffix nil) (suffix (concat (regexp-opt suffixes t) "\\'")) (string-dir (file-name-directory string))) (dolist (dir dirs) @@ -1766,7 +1767,14 @@ (defun Info-read-node-name-2 (dirs suffi ;; add the unsuffixed name as a completion option. (when (string-match suffix file) (setq file (substring file 0 (match-beginning 0))) - (push (if string-dir (concat string-dir file) file) names))))) + (push (if string-dir (concat string-dir file) file) + names-sans-suffix))))) + ;; If there is just one file, don't duplicate it with suffixes, + ;; so `Info-read-node-name-1' will be able to complete a single + ;; candidate and to add the terminating ")". + (if (and (= (length names) 1) (= (length names-sans-suffix) 1)) + (setq names names-sans-suffix) + (setq names (append names-sans-suffix names))) (complete-with-action action names string pred))) (defun Info-read-node-name-1 (string predicate code) @@ -5181,13 +5189,16 @@ (defun info--manual-names () (with-current-buffer buffer (and (eq major-mode 'Info-mode) (stringp Info-current-file) + (not (string= (substring (buffer-name) 0 1) " ")) (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)))))) + (all-completions + "" + (apply-partially 'Info-read-node-name-2 + Info-directory-list + (mapcar 'car Info-suffix-list))))))) (provide 'info)