unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
@ 2012-09-16 17:59 Dani Moncayo
  2012-09-16 19:39 ` Dani Moncayo
  2012-09-17 21:12 ` Stefan Monnier
  0 siblings, 2 replies; 16+ messages in thread
From: Dani Moncayo @ 2012-09-16 17:59 UTC (permalink / raw)
  To: 12456

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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  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
  1 sibling, 0 replies; 16+ messages in thread
From: Dani Moncayo @ 2012-09-16 19:39 UTC (permalink / raw)
  To: 12456

> 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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  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
  1 sibling, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2012-09-17 21:12 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 12456

> 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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-09-17 21:12 ` Stefan Monnier
@ 2012-09-18  6:23   ` Eli Zaretskii
  2012-09-18 12:22     ` Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-18  6:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12456

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Date: Mon, 17 Sep 2012 17:12:10 -0400
> Cc: 12456@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"...





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-09-18  6:23   ` Eli Zaretskii
@ 2012-09-18 12:22     ` Stefan Monnier
  2012-09-18 13:52       ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2012-09-18 12:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 12456

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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-09-18 12:22     ` Stefan Monnier
@ 2012-09-18 13:52       ` Eli Zaretskii
  2012-09-18 14:26         ` Dani Moncayo
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-18 13:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12456

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: dmoncayo@gmail.com,  12456@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)".





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-09-18 13:52       ` Eli Zaretskii
@ 2012-09-18 14:26         ` Dani Moncayo
  2012-09-18 16:57           ` Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Dani Moncayo @ 2012-09-18 14:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 12456

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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-09-18 14:26         ` Dani Moncayo
@ 2012-09-18 16:57           ` Stefan Monnier
  2012-09-18 20:03             ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2012-09-18 16:57 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 12456

> 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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-09-18 16:57           ` Stefan Monnier
@ 2012-09-18 20:03             ` Juri Linkov
  2012-12-15 15:30               ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2012-09-18 20:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12456

>> * "(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))))






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-09-18 20:03             ` Juri Linkov
@ 2012-12-15 15:30               ` Juri Linkov
  2012-12-27 20:42                 ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2012-12-15 15:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12456

>>> * "(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))
+
 \f
 (defun Info-restore-point (hl)
   "If this node has been visited, restore the point value when we left."






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-12-15 15:30               ` Juri Linkov
@ 2012-12-27 20:42                 ` Juri Linkov
  2012-12-27 21:37                   ` Dani Moncayo
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2012-12-27 20:42 UTC (permalink / raw)
  To: 12456-done

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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-12-27 20:42                 ` Juri Linkov
@ 2012-12-27 21:37                   ` Dani Moncayo
  2012-12-27 21:57                     ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Dani Moncayo @ 2012-12-27 21:37 UTC (permalink / raw)
  To: juri; +Cc: 12456

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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-12-27 21:37                   ` Dani Moncayo
@ 2012-12-27 21:57                     ` Juri Linkov
  2012-12-28 23:57                       ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2012-12-27 21:57 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 12456

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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-12-27 21:57                     ` Juri Linkov
@ 2012-12-28 23:57                       ` Juri Linkov
  2012-12-29  0:24                         ` Dani Moncayo
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2012-12-28 23:57 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 12456

>> 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".





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-12-28 23:57                       ` Juri Linkov
@ 2012-12-29  0:24                         ` Dani Moncayo
  2012-12-29 21:59                           ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Dani Moncayo @ 2012-12-29  0:24 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 12456

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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
  2012-12-29  0:24                         ` Dani Moncayo
@ 2012-12-29 21:59                           ` Juri Linkov
  0 siblings, 0 replies; 16+ messages in thread
From: Juri Linkov @ 2012-12-29 21:59 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 12456

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





^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-12-29 21:59 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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