GNU bug report logs - #10771
TAB completion for info-display-manual

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Thu, 9 Feb 2012 06:38:01 UTC

Severity: wishlist

Tags: patch

Found in version 24.0.93

Done: Chong Yidong <cyd <at> gnu.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 10771 in the body.
You can then email your comments to 10771 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#10771; Package emacs. (Thu, 09 Feb 2012 06:38:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: TAB completion for info-display-manual
Date: Thu, 09 Feb 2012 01:36:37 -0500
Package: emacs
Version: 24.0.93
Severity: wishlist

emacs -Q 
M-x info-display-manual RET em TAB

I hoped this would offer completion over the manuals in my INFOPATH, but
it just inserts a literal tab.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10771; Package emacs. (Thu, 09 Feb 2012 09:33:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 10771 <at> debbugs.gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Thu, 09 Feb 2012 11:28:18 +0200
tags 10771 patch
thanks

> M-x info-display-manual RET em TAB
>
> I hoped this would offer completion over the manuals in my INFOPATH, but
> it just inserts a literal tab.

This patch offers completion:

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-01-25 17:54:01 +0000
+++ lisp/info.el	2012-02-09 09:27:10 +0000
@@ -4984,7 +4984,13 @@ (defun Info-bookmark-jump (bmk)
 ;;;###autoload
 (defun info-display-manual (manual)
   "Go to Info buffer that displays MANUAL, creating it if none already exists."
-  (interactive "sManual name: ")
+  (interactive
+   (list
+    (completing-read "Manual name: "
+		     (apply-partially 'Info-read-node-name-2
+				      Info-directory-list
+				      (mapcar 'car Info-suffix-list))
+		     nil t)))
   (let ((blist (buffer-list))
 	(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
 	(case-fold-search t)





Added tag(s) patch. Request was from Juri Linkov <juri <at> jurta.org> to control <at> debbugs.gnu.org. (Thu, 09 Feb 2012 09:33:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10771; Package emacs. (Thu, 09 Feb 2012 18:44:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: rgm <at> gnu.org, 10771 <at> debbugs.gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Thu, 09 Feb 2012 20:42:17 +0200
> From: Juri Linkov <juri <at> jurta.org>
> Date: Thu, 09 Feb 2012 11:28:18 +0200
> Cc: 10771 <at> debbugs.gnu.org
> 
> > M-x info-display-manual RET em TAB
> >
> > I hoped this would offer completion over the manuals in my INFOPATH, but
> > it just inserts a literal tab.
> 
> This patch offers completion:
> 
> === modified file 'lisp/info.el'
> --- lisp/info.el	2012-01-25 17:54:01 +0000
> +++ lisp/info.el	2012-02-09 09:27:10 +0000
> @@ -4984,7 +4984,13 @@ (defun Info-bookmark-jump (bmk)
>  ;;;###autoload
>  (defun info-display-manual (manual)
>    "Go to Info buffer that displays MANUAL, creating it if none already exists."
> -  (interactive "sManual name: ")
> +  (interactive
> +   (list
> +    (completing-read "Manual name: "
> +		     (apply-partially 'Info-read-node-name-2
> +				      Info-directory-list
> +				      (mapcar 'car Info-suffix-list))
> +		     nil t)))
>    (let ((blist (buffer-list))
>  	(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
>  	(case-fold-search t)

Thanks, but this is wrong: it should offer completion only on Info
buffers that already exist in the current session.  Completion on
manuals installed on the system is perhaps for "C-u C-h i" or some
variation of it.

The purpose of this command is to assist with switching between
manuals that are already loaded, not in adding others.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10771; Package emacs. (Fri, 10 Feb 2012 10:25:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rgm <at> gnu.org, 10771 <at> debbugs.gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Fri, 10 Feb 2012 12:17:50 +0200
> The purpose of this command is to assist with switching between
> manuals that are already loaded, not in adding others.

If you often switch between loaded manuals, then this is easy to do
using the minibuffer history commands, e.g. after visiting two manuals:

M-x info-display-manual RET gnus RET
M-x info-display-manual RET emacs RET

switching between these two manuals:

M-x info-display-manual RET M-p M-p RET
M-x info-display-manual RET M-p M-p RET

BTW, do you know that an easy way to switch between manuals is using

`C-1 C-h i'
`C-2 C-h i'
`C-3 C-h i'
etc.

This is similar to switching between numbered frames
with e.g. `C-2 C-x 5 o'.

Do you switch them using frame numbers or frame names
with the command `select-frame-by-name'?

Maybe then `info-display-manual' should be renamed to
`info-select-manual-by-name'?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10771; Package emacs. (Sun, 02 Dec 2012 06:48:01 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Juri Linkov <juri <at> jurta.org>, 10771 <at> debbugs.gnu.org, rgm <at> gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Sun, 02 Dec 2012 14:44:45 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, but this is wrong: it should offer completion only on Info
> buffers that already exist in the current session.  Completion on
> manuals installed on the system is perhaps for "C-u C-h i" or some
> variation of it.
>
> The purpose of this command is to assist with switching between
> manuals that are already loaded, not in adding others.

I disagree; completion should be provided for any value that the command
accepts as an argument, so Juri's patch does the right thing.  I've
committed it to trunk (with a minor fix).

(If one wishes to get fancy, I suppose one could define a completion
category override to cause completion to favor manuals in existing Info
buffers.  Not sure if that would produce confusing results, though.)




bug closed, send any further explanations to 10771 <at> debbugs.gnu.org and Glenn Morris <rgm <at> gnu.org> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 02 Dec 2012 06:48:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10771; Package emacs. (Sun, 02 Dec 2012 17:28:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chong Yidong <cyd <at> gnu.org>
Cc: juri <at> jurta.org, 10771 <at> debbugs.gnu.org, rgm <at> gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Sun, 02 Dec 2012 19:25:05 +0200
> From: Chong Yidong <cyd <at> gnu.org>
> Cc: Juri Linkov <juri <at> jurta.org>,  10771 <at> debbugs.gnu.org,  rgm <at> gnu.org
> Date: Sun, 02 Dec 2012 14:44:45 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Thanks, but this is wrong: it should offer completion only on Info
> > buffers that already exist in the current session.  Completion on
> > manuals installed on the system is perhaps for "C-u C-h i" or some
> > variation of it.
> >
> > The purpose of this command is to assist with switching between
> > manuals that are already loaded, not in adding others.
> 
> I disagree; completion should be provided for any value that the command
> accepts as an argument, so Juri's patch does the right thing.

No, it doesn't.  The command looks up its argument among Info
_buffers_ first, and only if not found, falls back to searching the
manuals installed on the system.  So at the very least, the completion
should include in the collection the manuals loaded into Info buffers
in the current session.  Because manuals loaded into my Info buffers
do not necessarily reflect Info files on my disk.

> If one wishes to get fancy, I suppose one could define a completion
> category override to cause completion to favor manuals in existing Info
> buffers.

There's no need to favor existing buffers, but there is a need to
include them in the completion.




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

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

From: Juri Linkov <juri <at> jurta.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 10771 <at> debbugs.gnu.org, Chong Yidong <cyd <at> gnu.org>, rgm <at> gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Sun, 02 Dec 2012 23:12:35 +0200
> Because manuals loaded into my Info buffers do not necessarily reflect
> Info files on my disk.

Is this because you delete Info files from the disk leaving open
their Info buffers?  I'm not sure whether additional complexity
is necessary to handle completion for such rare cases, but at least
the minibuffer should allow you to enter such manual names.
I mean changing the REQUIRE-MATCH arg of `completing-read' from t to nil,
so you can still enter these manual names like at the time when
this command accepted a plain string before the latest change.

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-12-02 20:07:04 +0000
+++ lisp/info.el	2012-12-02 21:11:17 +0000
@@ -5138,7 +5138,7 @@ (defun info-display-manual (manual)
 		       (apply-partially 'Info-read-node-name-2
 					Info-directory-list
 					(mapcar 'car Info-suffix-list))
-		       nil t))))
+		       nil nil))))
   (let ((blist (buffer-list))
 	(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
 	(case-fold-search t)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10771; Package emacs. (Sun, 02 Dec 2012 21:36:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 10771 <at> debbugs.gnu.org, cyd <at> gnu.org, rgm <at> gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Sun, 02 Dec 2012 23:32:28 +0200
> From: Juri Linkov <juri <at> jurta.org>
> Cc: Chong Yidong <cyd <at> gnu.org>,  10771 <at> debbugs.gnu.org,  rgm <at> gnu.org
> Date: Sun, 02 Dec 2012 23:12:35 +0200
> 
> > Because manuals loaded into my Info buffers do not necessarily reflect
> > Info files on my disk.
> 
> Is this because you delete Info files from the disk leaving open
> their Info buffers?

No, it's because I don't want to be restricted to manuals found in
directories that are mentioned in Info-directory-list.

In general, the Info buffers in the session should not be restricted
to what "M-x info" can find, because we have "C-u C-h i" and other
methods of loading manuals by their exact file name.

> I'm not sure whether additional complexity is necessary to handle
> completion for such rare cases

Well, _I_ wrote this command, and I needed it precisely because I have
dozens of Info manuals loaded in my usual Emacs session.  This case is
not rare for me.


> but at least
> the minibuffer should allow you to enter such manual names.
> I mean changing the REQUIRE-MATCH arg of `completing-read' from t to nil,
> so you can still enter these manual names like at the time when
> this command accepted a plain string before the latest change.
> 
> === modified file 'lisp/info.el'
> --- lisp/info.el	2012-12-02 20:07:04 +0000
> +++ lisp/info.el	2012-12-02 21:11:17 +0000
> @@ -5138,7 +5138,7 @@ (defun info-display-manual (manual)
>  		       (apply-partially 'Info-read-node-name-2
>  					Info-directory-list
>  					(mapcar 'car Info-suffix-list))
> -		       nil t))))
> +		       nil nil))))
>    (let ((blist (buffer-list))
>  	(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
>  	(case-fold-search t)

How is this better than the original command against which this bug
was filed?




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

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

From: Juri Linkov <juri <at> jurta.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 10771 <at> debbugs.gnu.org, cyd <at> gnu.org, rgm <at> gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Sun, 02 Dec 2012 23:57:52 +0200
>> @@ -5138,7 +5138,7 @@ (defun info-display-manual (manual)
>>  		       (apply-partially 'Info-read-node-name-2
>>  					Info-directory-list
>>  					(mapcar 'car Info-suffix-list))
>> -		       nil t))))
>> +		       nil nil))))
>>    (let ((blist (buffer-list))
>>  	(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
>>  	(case-fold-search t)
>
> How is this better than the original command against which this bug
> was filed?

At least this is not worse than the original command that reads a manual name
without completion.  Completion is useful to read a manual name that is
not already visited.  So when you want to visit a new manual, you can use
completion, when a manual is already visited, you can type its name
and get it from the history with M-p.

BTW, there is another problem with selecting an Info buffer
by its Info file name: what if there are two Info buffers
visiting a manual with the same name.  Which one of them
should be preferred by this command?  Also which manual should be
preferred in completion when one manual is already visited
and another manual with the same name is available in Info-directory-list?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10771; Package emacs. (Mon, 03 Dec 2012 03:41:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 10771 <at> debbugs.gnu.org, cyd <at> gnu.org, rgm <at> gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Mon, 03 Dec 2012 05:37:54 +0200
> From: Juri Linkov <juri <at> jurta.org>
> Cc: cyd <at> gnu.org,  10771 <at> debbugs.gnu.org,  rgm <at> gnu.org
> Date: Sun, 02 Dec 2012 23:57:52 +0200
> 
> >> @@ -5138,7 +5138,7 @@ (defun info-display-manual (manual)
> >>  		       (apply-partially 'Info-read-node-name-2
> >>  					Info-directory-list
> >>  					(mapcar 'car Info-suffix-list))
> >> -		       nil t))))
> >> +		       nil nil))))
> >>    (let ((blist (buffer-list))
> >>  	(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
> >>  	(case-fold-search t)
> >
> > How is this better than the original command against which this bug
> > was filed?
> 
> At least this is not worse than the original command that reads a manual name
> without completion.

I didn't say it was worse.  I asked how it was better.

> BTW, there is another problem with selecting an Info buffer
> by its Info file name: what if there are two Info buffers
> visiting a manual with the same name.

Then the command finds one of them, and if you repeat the same
command, it finds the second, etc.  Which is fine with me, and I do
have such multiple manuals by the same name loaded in the same
session.

> Which one of them should be preferred by this command?

I don't need any preference.  All I need is a reasonable way of
finding each one of them.

> Also which manual should be preferred in completion when one manual
> is already visited and another manual with the same name is
> available in Info-directory-list?

The visited one, of course.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10771; Package emacs. (Mon, 03 Dec 2012 07:00:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Juri Linkov <juri <at> jurta.org>, 10771 <at> debbugs.gnu.org, rgm <at> gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Mon, 03 Dec 2012 14:57:14 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> At least this is not worse than the original command that reads a
>> manual name without completion.
>
> I didn't say it was worse.  I asked how it was better.

How about adding existing Info buffers' manual names to the completion
table too, like the following?

=== modified file 'lisp/info.el'
*** lisp/info.el	2012-12-02 06:41:22 +0000
--- lisp/info.el	2012-12-03 06:55:15 +0000
***************
*** 5105,5113 ****
      (progn
        (info-initialize)
        (completing-read "Manual name: "
! 		       (apply-partially 'Info-read-node-name-2
! 					Info-directory-list
! 					(mapcar 'car Info-suffix-list))
  		       nil t))))
    (let ((blist (buffer-list))
  	(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
--- 5105,5111 ----
      (progn
        (info-initialize)
        (completing-read "Manual name: "
! 		       (info--manual-names)
  		       nil t))))
    (let ((blist (buffer-list))
  	(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
***************
*** 5126,5131 ****
--- 5124,5143 ----
        (info (Info-find-file manual)
  	    (generate-new-buffer-name "*info*")))))
  
+ (defun info--manual-names ()
+   (let (names)
+     (dolist (buffer (buffer-list))
+       (with-current-buffer buffer
+ 	(when (and (eq major-mode 'Info-mode)
+ 		   (stringp Info-current-file))
+ 	  (push (file-name-sans-extension
+ 		 (file-name-nondirectory Info-current-file))
+ 		names))))
+     (delete-dups (append names
+ 			 (apply-partially 'Info-read-node-name-2
+ 					  Info-directory-list
+ 					  (mapcar 'car Info-suffix-list))))))
+ 
  (provide 'info)
  
  ;;; info.el ends here





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10771; Package emacs. (Mon, 03 Dec 2012 16:35:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chong Yidong <cyd <at> gnu.org>
Cc: juri <at> jurta.org, 10771 <at> debbugs.gnu.org, rgm <at> gnu.org
Subject: Re: bug#10771: TAB completion for info-display-manual
Date: Mon, 03 Dec 2012 18:31:26 +0200
> From: Chong Yidong <cyd <at> gnu.org>
> Cc: Juri Linkov <juri <at> jurta.org>,  10771 <at> debbugs.gnu.org,  rgm <at> gnu.org
> Date: Mon, 03 Dec 2012 14:57:14 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> At least this is not worse than the original command that reads a
> >> manual name without completion.
> >
> > I didn't say it was worse.  I asked how it was better.
> 
> How about adding existing Info buffers' manual names to the completion
> table too, like the following?

Fine with me, but please nreverse the list returned by
info--manual-names, so that it is in the order of buffer-list.  This
is important because that is the order in which the command examines
the buffers.

Thanks.




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

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

Previous Next


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