GNU bug report logs - #12456
24.2.50; Completion in `Info-goto-node' (cross-manual jump)

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Sun, 16 Sep 2012 18:01:02 UTC

Severity: normal

Found in version 24.2.50

Fixed in version 24.3.50

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


Message #52 received at 12456 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 12456 <at> debbugs.gnu.org
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Sat, 29 Dec 2012 23:59:47 +0200
> 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)
 




This bug report was last modified 12 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.