Subject: bug#19443: 25.0.50; `info-display-manual' could limit the choice to currently visited manuals if given a prefix arg for convenience

From: Filipp Gunbin <[email-masked]>
Date: Tue, 30 Dec 2014 14:46:30 +0300

On 27/12/2014 10:16 -0500, Stefan Monnier wrote:

>> "Think about whether your change requires updating the documentation
>> (both manuals and doc-strings).  If you know it does not, mark the NEWS
>> entry with "---".  If you know that *all* the necessary documentation
>> updates have been made, mark the entry with "+++". Otherwise do not mark
>> it."
>
> The --- and +++ in etc/NEWS only relate to the manual.
> The docstrings should *always* be updated right away.
>
>
>         Stefan

Thanks Stefan and Eli,

Here's the revised patch.  I also updated the CONTRIBUTE file in
accordance with what you wrote.  Could you please review?

Filipp

diff --git a/CONTRIBUTE b/CONTRIBUTE
index 0e019d3..5cf015f 100644
--- a/CONTRIBUTE
+++ b/CONTRIBUTE
@@ -180,10 +180,12 @@ by following links from http://savannah.gnu.org/mail/?group=emacs .
 
 Any change that matters to end-users should have an entry in etc/NEWS.
 
-Think about whether your change requires updating the documentation
-(both manuals and doc-strings).  If you know it does not, mark the NEWS
-entry with "---".  If you know that *all* the necessary documentation
-updates have been made, mark the entry with "+++". Otherwise do not mark it.
+Doc-strings should be updated together with the code.
+
+Think about whether your change requires updating the manuals.  If you
+know it does not, mark the NEWS entry with "---".  If you know
+that *all* the necessary documentation updates have been made, mark
+the entry with "+++". Otherwise do not mark it.
 
 ** Understanding Emacs Internals.
 
diff --git a/doc/misc/info.texi b/doc/misc/info.texi
index a3a14a3..0e2e64f 100644
--- a/doc/misc/info.texi
+++ b/doc/misc/info.texi
@@ -1151,7 +1151,10 @@ switches to the buffer @file{*info*<2>}, creating it if necessary.
   If you have created many Info buffers in Emacs, you might find it
 difficult to remember which buffer is showing which manual.  You can
 use the command @kbd{M-x info-display-manual} to show an Info manual
-by name, reusing an existing buffer if there is one.
+by name, reusing an existing buffer if there is one.  When given a
+prefix argument, this command limits the completion alternatives to
+currently visited info files, thus giving a convenient way to switch
+between several manuals.
 
 @node Emacs Info Variables
 @section Emacs Info-mode Variables
diff --git a/etc/NEWS b/etc/NEWS
index ae0cb70..ec5fe0d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -338,6 +338,11 @@ The remainder were:
 ---
 ** `Info-fontify-maximum-menu-size' can be t for no limit.
 
++++
+** `info-display-manual' can now be given a prefix argument which (any
+non-nil value) directs the command to limit the completion
+alternatives to currently visited manuals.
+
 ---
 ** ntlm.el has support for NTLM2.
 
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6249a30..86ed70f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-30  Filipp Gunbin  <[email-masked]>
+
+ 	* info.el (info-display-manual): Limit the completion alternatives
+	to currently visited manuals if prefix argument is non-nil.
+
 2014-12-30  Dmitry Gutov  <[email-masked]>
 
 	* menu-bar.el (menu-bar-goto-uses-etags-p): New function.
diff --git a/lisp/info.el b/lisp/info.el
index 7c4d7f3..33e982d 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -5277,13 +5277,15 @@ type returned by `Info-bookmark-make-record', which see."
 (defun info-display-manual (manual)
   "Display an Info buffer displaying MANUAL.
 If there is an existing Info buffer for MANUAL, display it.
-Otherwise, visit the manual in a new Info buffer."
+Otherwise, visit the manual in a new Info buffer.  In interactive
+use, a prefix argument directs this command to limit the
+completion alternatives to currently visited manuals."
   (interactive
    (list
     (progn
       (info-initialize)
       (completing-read "Manual name: "
-		       (info--manual-names)
+		       (info--manual-names current-prefix-arg)
 		       nil t))))
   (let ((blist (buffer-list))
 	(manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
@@ -5302,7 +5304,7 @@ Otherwise, visit the manual in a new Info buffer."
       (info (Info-find-file manual)
 	    (generate-new-buffer-name "*info*")))))
 
-(defun info--manual-names ()
+(defun info--manual-names (visited-only)
   (let (names)
     (dolist (buffer (buffer-list))
       (with-current-buffer buffer
@@ -5313,11 +5315,12 @@ Otherwise, visit the manual in a new Info buffer."
 		    (file-name-nondirectory Info-current-file))
 		   names))))
     (delete-dups (append (nreverse names)
-			 (all-completions
-			  ""
-			  (apply-partially 'Info-read-node-name-2
-					   Info-directory-list
-					   (mapcar 'car Info-suffix-list)))))))
+			 (when (not visited-only)
+			   (all-completions
+			    ""
+			    (apply-partially 'Info-read-node-name-2
+					     Info-directory-list
+					     (mapcar 'car Info-suffix-list))))))))
 
 (provide 'info)