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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12456 in the body.
You can then email your comments to 12456 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Sun, 16 Sep 2012 18:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dani Moncayo <dmoncayo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 16 Sep 2012 18:01:02 GMT) Full text and rfc822 format available.

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

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
Date: Sun, 16 Sep 2012 19:59:43 +0200
Recipe from emacs -Q: C-h r g ( e l i s p ) n n <TAB>

When I do it, I see in the echo area the message "[Complete, but not
unique]", which is wrong, as the elisp manual has no node called (nor
beggining with) "nn".

OTOH, if I repeat the experiment but this time with "(elisp)num",
Emacs says the same message (this time is right), but a second <TAB>
produces the message "[No completions]", which is wrong, as there is 3
nodes in the elisp manual whose names start with "num".


In GNU Emacs 24.2.50.1 (i386-mingw-nt6.1.7601)
 of 2012-09-16 on DANI-PC
Bzr revision: 110047 handa <at> gnu.org-20120916114848-0p2g6uqosfsrx682
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -I../../libs/libxpm-3.5.8/include -I../../libs/libxpm-3.5.8/src
 -I../../libs/libpng-1.4.10 -I../../libs/zlib-1.2.6
 -I../../libs/giflib-4.1.4-1/include -I../../libs/jpeg-6b-4/include
 -I../../libs/tiff-3.8.2-1/include
 -I../../libs/libxml2-2.7.8-w32-bin/include/libxml2
 -I../../libs/gnutls-3.0.16/include
 -I../../libs/libiconv-1.14-2-mingw32-dev/include'

Important settings:
  value of $LANG: ESN
  locale-coding-system: cp1252
  default enable-multibyte-characters: t


-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Sun, 16 Sep 2012 19:41:02 GMT) Full text and rfc822 format available.

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

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: 12456 <at> debbugs.gnu.org
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Sun, 16 Sep 2012 21:39:22 +0200
> Recipe from emacs -Q: C-h r g ( e l i s p ) n n <TAB>
>
> When I do it, I see in the echo area the message "[Complete, but not
> unique]", which is wrong, as the elisp manual has no node called (nor
> beggining with) "nn".
>
> OTOH, if I repeat the experiment but this time with "(elisp)num",
> Emacs says the same message (this time is right), but a second <TAB>
                               ^^^^^^^^^^^^^^^^^^
Actually this is wrong too, as "(elisp)num" is not _complete_ (besides
not being unique).

> produces the message "[No completions]", which is wrong, as there is 3
> nodes in the elisp manual whose names start with "num".


-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Mon, 17 Sep 2012 21:14:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
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: Mon, 17 Sep 2012 17:12:10 -0400
> Recipe from emacs -Q: C-h r g ( e l i s p ) n n <TAB>
> When I do it, I see in the echo area the message "[Complete, but not
> unique]", which is wrong, as the elisp manual has no node called (nor
> beggining with) "nn".
> OTOH, if I repeat the experiment but this time with "(elisp)num",
> Emacs says the same message (this time is right), but a second <TAB>
> produces the message "[No completions]", which is wrong, as there is 3
> nodes in the elisp manual whose names start with "num".

IIRC the core of the problem is that Info's completion table does not
(yet) know how to do completion after something like "(elisp)", so it
basically returns some "dummy" completion data (because the way
completion tables are defined currently, they have no way to say "I
don't know").

So there are 2 ways to fix the above problem:
- Extend minibuffer.el so a completion table return "don't know" (at
  which point it could put a message like " [No completion info]").
- Extend info.el so that it does provide actual completion by opening up
  the "elisp" info file and gathering the corresponding node names.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Tue, 18 Sep 2012 06:25:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 12456 <at> debbugs.gnu.org, dmoncayo <at> gmail.com
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Tue, 18 Sep 2012 09:23:18 +0300
> From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
> Date: Mon, 17 Sep 2012 17:12:10 -0400
> Cc: 12456 <at> debbugs.gnu.org
> 
> > Recipe from emacs -Q: C-h r g ( e l i s p ) n n <TAB>
> > When I do it, I see in the echo area the message "[Complete, but not
> > unique]", which is wrong, as the elisp manual has no node called (nor
> > beggining with) "nn".
> > OTOH, if I repeat the experiment but this time with "(elisp)num",
> > Emacs says the same message (this time is right), but a second <TAB>
> > produces the message "[No completions]", which is wrong, as there is 3
> > nodes in the elisp manual whose names start with "num".
> 
> IIRC the core of the problem is that Info's completion table does not
> (yet) know how to do completion after something like "(elisp)", so it
> basically returns some "dummy" completion data (because the way
> completion tables are defined currently, they have no way to say "I
> don't know").

Can the completion tables say no completion candidates at all?  That
would be the best short-term solution; the stand-alone Info reader
does just that.

> So there are 2 ways to fix the above problem:
> - Extend minibuffer.el so a completion table return "don't know" (at
>   which point it could put a message like " [No completion info]").
> - Extend info.el so that it does provide actual completion by opening up
>   the "elisp" info file and gathering the corresponding node names.

The latter sounds like the best long-term solution to me.  Of course,
next we will see a bug report with "g (eli TAB"...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Tue, 18 Sep 2012 12:25:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 12456 <at> debbugs.gnu.org, dmoncayo <at> gmail.com
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Tue, 18 Sep 2012 08:22:47 -0400
>> IIRC the core of the problem is that Info's completion table does not
>> (yet) know how to do completion after something like "(elisp)", so it
>> basically returns some "dummy" completion data (because the way
>> completion tables are defined currently, they have no way to say "I
>> don't know").

> Can the completion tables say no completion candidates at all?  That
> would be the best short-term solution; the stand-alone Info reader
> does just that.

So that we always get a [No completions] message?
We can try.  It's all decided in the following three lines of
Info-read-node-name-1:

   ((string-match "\\`(" string)
    (cond
     ((eq code nil) string)
     ((eq code t) nil)
     (t t)))

As long as we don't know the actual list of nodes, it's important to
return non-nil when `code' is `lambda': that's the `test-completion'
case, which determines whether RET will accept the user's input since
the completion is called with `require-match'.
     
>> So there are 2 ways to fix the above problem:
>> - Extend minibuffer.el so a completion table return "don't know" (at
>> which point it could put a message like " [No completion info]").
>> - Extend info.el so that it does provide actual completion by opening up
>> the "elisp" info file and gathering the corresponding node names.
> The latter sounds like the best long-term solution to me.

Agreed.

> Of course, next we will see a bug report with "g (eli TAB"...

Try it: that one already works.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Tue, 18 Sep 2012 13:55:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12456 <at> debbugs.gnu.org, dmoncayo <at> gmail.com
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Tue, 18 Sep 2012 16:52:16 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: dmoncayo <at> gmail.com,  12456 <at> debbugs.gnu.org
> Date: Tue, 18 Sep 2012 08:22:47 -0400
> 
> > Of course, next we will see a bug report with "g (eli TAB"...
> 
> Try it: that one already works.

Not if you expect it to show the list of nodes in "(elisp)".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Tue, 18 Sep 2012 14:29:01 GMT) Full text and rfc822 format available.

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

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 12456 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Tue, 18 Sep 2012 16:26:59 +0200
>> > Of course, next we will see a bug report with "g (eli TAB"...
>>
>> Try it: that one already works.
>
> Not if you expect it to show the list of nodes in "(elisp)".

I think that a reasonable behavior would be:
* "(eli<TAB>" completes just to "(elisp)" (or all manuals which begin
with "eli").
* "(elisp)<TAB>" completes to all nodes in the elisp manual.


-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Tue, 18 Sep 2012 16:59:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 12456 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Tue, 18 Sep 2012 12:57:22 -0400
> I think that a reasonable behavior would be:
> * "(eli<TAB>" completes just to "(elisp)" (or all manuals which begin
> with "eli").

Yes, that already works.

> * "(elisp)<TAB>" completes to all nodes in the elisp manual.

Yes, that's the part that's not yet implemented.  Patch welcome,


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Tue, 18 Sep 2012 20:10:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 12456 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Tue, 18 Sep 2012 23:03:21 +0300
>> * "(elisp)<TAB>" completes to all nodes in the elisp manual.
>
> Yes, that's the part that's not yet implemented.  Patch welcome,

This can be implemented by this patch.  The remaining problem is
that it's too slow because it doesn't cache completions of non-current
manuals.  Perhaps `Info-build-node-completions' should use `Info-toc-nodes'
that caches node names from all visited manuals.

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-09-13 22:01:45 +0000
+++ lisp/info.el	2012-09-18 20:02:43 +0000
@@ -1778,12 +1778,23 @@ (defun Info-read-node-name-1 (string pre
      (substring string 1)
      predicate
      code))
-   ;; If a file name was given, then any node is fair game.
-   ((string-match "\\`(" string)
-    (cond
-     ((eq code nil) string)
-     ((eq code t) nil)
-     (t t)))
+   ;; If a file name was given, complete nodes in the file.
+   ((string-match "\\`([^)]+)" string)
+    (let ((file (match-string 0 string))
+          (node (substring string (match-end 0))))
+      (completion-table-with-context
+       file
+       (apply-partially
+        (lambda (string pred action)
+          (complete-with-action
+           action
+           (with-temp-buffer
+             (Info-mode)
+             (Info-goto-node (concat file "Top"))
+             (Info-build-node-completions)
+             Info-current-file-completions)
+           string pred)))
+       node predicate code)))
    ;; Otherwise use Info-read-node-completion-table.
    (t (complete-with-action
        code Info-read-node-completion-table string predicate))))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Sat, 15 Dec 2012 15:37:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 12456 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Sat, 15 Dec 2012 17:30:30 +0200
>>> * "(elisp)<TAB>" completes to all nodes in the elisp manual.
>>
>> Yes, that's the part that's not yet implemented.  Patch welcome,
>
> This can be implemented by this patch.  The remaining problem is
> that it's too slow because it doesn't cache completions of non-current
> manuals.  Perhaps `Info-build-node-completions' should use `Info-toc-nodes'
> that caches node names from all visited manuals.

Actually I realized that `Info-toc-nodes' can't be used because it
doesn't contain Info anchors whereas `Info-build-node-completions'
adds anchors along with references.

So to be able to cache completions in non-current manuals
requires adding a global variable `Info-file-completions'
like in the patch below:

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-12-08 23:12:08 +0000
+++ lisp/info.el	2012-12-15 15:28:17 +0000
@@ -397,6 +395,10 @@ (defvar Info-tag-table-buffer nil
 (defvar Info-current-file-completions nil
   "Cached completion list for current Info file.")
 
+(defvar Info-file-completions nil
+  "Cached completion alist of visited Info files.
+Each element of the alist is (FILE . COMPLETIONS)")
+
 (defvar Info-file-supports-index-cookies nil
   "Non-nil if current Info file supports index cookies.")
 
@@ -1771,12 +1783,20 @@ (defun Info-read-node-name-1 (string pre
      (substring string 1)
      predicate
      code))
-   ;; If a file name was given, then any node is fair game.
-   ((string-match "\\`(" string)
-    (cond
-     ((eq code nil) string)
-     ((eq code t) nil)
-     (t t)))
+   ;; If a file name was given, complete nodes in the file.
+   ((string-match "\\`(\\([^)]+\\))" string)
+    (let ((file0 (match-string 0 string))
+	  (file1 (match-string 1 string))
+	  (node (substring string (match-end 0))))
+      (completion-table-with-context
+       file0
+       (apply-partially
+	(lambda (string pred action)
+	  (complete-with-action
+	   action
+	   (Info-build-node-completions (Info-find-file file1))
+	   string pred)))
+       node predicate code)))
    ;; Otherwise use Info-read-node-completion-table.
    (t (complete-with-action
        code Info-read-node-completion-table string predicate))))
@@ -1793,8 +1813,19 @@ (defun Info-read-node-name (prompt)
 	(Info-read-node-name prompt)
       nodename)))
 
-(defun Info-build-node-completions ()
+(defun Info-build-node-completions (&optional file)
+  (if file
+      (or (cdr (assoc file Info-file-completions))
+	  (with-temp-buffer
+	    (Info-mode)
+	    (Info-goto-node (format "(%s)Top" file))
+	    (Info-build-node-completions-1)
+	    (push (cons file Info-current-file-completions) Info-file-completions)
+	    Info-file-completions))
   (or Info-current-file-completions
+	(Info-build-node-completions-1))))
+
+(defun Info-build-node-completions-1 ()
       (let ((compl nil)
 	    ;; Bind this in case the user sets it to nil.
 	    (case-fold-search t)
@@ -1826,8 +1857,10 @@ (defun Info-build-node-completions ()
 		      (setq compl
 			    (cons (list (match-string-no-properties 1))
 				  compl))))))))
-	(setq compl (cons '("*") compl))
-	(set (make-local-variable 'Info-current-file-completions) compl))))
+    (setq compl (cons '("*") (nreverse compl)))
+    (set (make-local-variable 'Info-current-file-completions) compl)
+    compl))
+
 
 (defun Info-restore-point (hl)
   "If this node has been visited, restore the point value when we left."





Reply sent to Juri Linkov <juri <at> jurta.org>:
You have taken responsibility. (Thu, 27 Dec 2012 20:44:02 GMT) Full text and rfc822 format available.

Notification sent to Dani Moncayo <dmoncayo <at> gmail.com>:
bug acknowledged by developer. (Thu, 27 Dec 2012 20:44:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: 12456-done <at> debbugs.gnu.org
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Thu, 27 Dec 2012 22:42:18 +0200
> So to be able to cache completions in non-current manuals
> requires adding a global variable `Info-file-completions'
> like in the patch below:

Installed to the trunk and closed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Thu, 27 Dec 2012 21:38:02 GMT) Full text and rfc822 format available.

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

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: juri <at> jurta.org
Cc: 12456 <at> debbugs.gnu.org
Subject: Re: bug#12456: 24.2.50;
	Completion in `Info-goto-node' (cross-manual jump)
Date: Thu, 27 Dec 2012 22:37:04 +0100
>> So to be able to cache completions in non-current manuals
>> requires adding a global variable `Info-file-completions'
>> like in the patch below:
>
> Installed to the trunk and closed.

Thanks, Juri.

One question: if I do (from emacs -Q) `C-h r g ( e l i TAB TAB', I see
two completion candidates: "elisp" and "elisp.info".  This is a bug,
no?


-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Thu, 27 Dec 2012 22:24:02 GMT) Full text and rfc822 format available.

Message #43 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: Thu, 27 Dec 2012 23:57:04 +0200
> One question: if I do (from emacs -Q) `C-h r g ( e l i TAB TAB', I see
> two completion candidates: "elisp" and "elisp.info".  This is a bug,
> no?

I doubt its usefulness too because it doesn't allow TAB to add the
closing paren automatically as it does for a single completion,
but as a comment in `Info-read-node-name-2' says:

	  ;; If the file name ends in a standard suffix,
	  ;; add the unsuffixed name as a completion option.

So code adds both "elisp.info" with a standard suffix ".info"
and the unsuffixed name "elisp".

This means this intentionally is a feature, and not a bug.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Sat, 29 Dec 2012 00:20:01 GMT) Full text and rfc822 format available.

Message #46 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 01:57:11 +0200
>> One question: if I do (from emacs -Q) `C-h r g ( e l i TAB TAB', I see
>> two completion candidates: "elisp" and "elisp.info".  This is a bug,
>> no?
>
> I doubt its usefulness too because it doesn't allow TAB to add the
> closing paren automatically as it does for a single completion,
> but as a comment in `Info-read-node-name-2' says:
>
> 	  ;; If the file name ends in a standard suffix,
> 	  ;; add the unsuffixed name as a completion option.
>
> So code adds both "elisp.info" with a standard suffix ".info"
> and the unsuffixed name "elisp".
>
> This means this intentionally is a feature, and not a bug.

But this doesn't mean it is a good feature.  Another similar command
`info-display-manual' doesn't add duplicates "elisp" and "elisp.info",
so when you do `M-x info-display-manual RET TAB' it displays a single
completion for every Info manual name without adding the suffix ".info".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Sat, 29 Dec 2012 00:26:02 GMT) Full text and rfc822 format available.

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

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Juri Linkov <juri <at> jurta.org>
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 01:24:35 +0100
>>> One question: if I do (from emacs -Q) `C-h r g ( e l i TAB TAB', I see
>>> two completion candidates: "elisp" and "elisp.info".  This is a bug,
>>> no?
>>
>> I doubt its usefulness too because it doesn't allow TAB to add the
>> closing paren automatically as it does for a single completion,
>> but as a comment in `Info-read-node-name-2' says:
>>
>>         ;; If the file name ends in a standard suffix,
>>         ;; add the unsuffixed name as a completion option.
>>
>> So code adds both "elisp.info" with a standard suffix ".info"
>> and the unsuffixed name "elisp".
>>
>> This means this intentionally is a feature, and not a bug.
>
> But this doesn't mean it is a good feature.  Another similar command
> `info-display-manual' doesn't add duplicates "elisp" and "elisp.info",
> so when you do `M-x info-display-manual RET TAB' it displays a single
> completion for every Info manual name without adding the suffix ".info".

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.

-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12456; Package emacs. (Sat, 29 Dec 2012 22:22:02 GMT) Full text and rfc822 format available.

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)
 




bug Marked as fixed in versions 24.3.50. Request was from Juri Linkov <juri <at> jurta.org> to control <at> debbugs.gnu.org. (Tue, 08 Jan 2013 00:33:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 05 Feb 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 89 days ago.

Previous Next


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