unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Dani Moncayo <dmoncayo@gmail.com>
Cc: 12456@debbugs.gnu.org
Subject: bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
Date: Sat, 29 Dec 2012 23:59:47 +0200	[thread overview]
Message-ID: <87vcbkzf9d.fsf@mail.jurta.org> (raw)
In-Reply-To: <CAH8Pv0joUr6EyZeDbtR6727VZyfTrrhmaX+ro8eChi5kUJGNdg@mail.gmail.com> (Dani Moncayo's message of "Sat, 29 Dec 2012 01:24:35 +0100")

> 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)
 





      reply	other threads:[~2012-12-29 21:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-16 17:59 bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump) Dani Moncayo
2012-09-16 19:39 ` Dani Moncayo
2012-09-17 21:12 ` Stefan Monnier
2012-09-18  6:23   ` Eli Zaretskii
2012-09-18 12:22     ` Stefan Monnier
2012-09-18 13:52       ` Eli Zaretskii
2012-09-18 14:26         ` Dani Moncayo
2012-09-18 16:57           ` Stefan Monnier
2012-09-18 20:03             ` Juri Linkov
2012-12-15 15:30               ` Juri Linkov
2012-12-27 20:42                 ` Juri Linkov
2012-12-27 21:37                   ` Dani Moncayo
2012-12-27 21:57                     ` Juri Linkov
2012-12-28 23:57                       ` Juri Linkov
2012-12-29  0:24                         ` Dani Moncayo
2012-12-29 21:59                           ` Juri Linkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vcbkzf9d.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=12456@debbugs.gnu.org \
    --cc=dmoncayo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).