Subject: bug#13190: [PATCH] Help xref truncates info navigation stack, and displays info in too many windows

From: Kelly Dean <[email-masked]>
Date: Sat, 15 Dec 2012 03:17:14 -0800 (PST)

On 24.2, emacs -Q
M-x split-window C-h r
Follow any link, then follow another one, then do Info-history-back twice. Then you could return to the other nodes again using Info-history-forward, but don't do that yet.
Do C-h f visited-file-modtime RET, then click the link in the help page for the info node.
Two problems: it opens the info page in both windows, and it truncates the navigation stack, so Info-history-forward won't return you to the other nodes you were visiting. You can still use Info-history to see the nodes you were visiting, but it's distracting to have to do that.
The attached helpinfobug.patch fixes both problems by creating a new info buffer rather than reusing an existing one. I think this is the simplest solution, though maybe it'd be better to search all info buffers for one which is already displaying the target node, and switch to one if found, so if you repeatedly follow the same info link from a help page, you'll get no more than one new info buffer, rather than multiple new ones.
--- emacs-24.2/lisp/help-mode.el	2012-08-23 14:33:42.000000000 +0900
+++ emacs-24.2/lisp/help-mode.el.new3	2012-12-15 19:52:25.907113419 +0900
@@ -733,7 +733,8 @@
 a proper [back] button."
   ;; There is a reference at point.  Follow it.
   (let ((help-xref-following t))
-    (apply function args)))
+    (apply function (if (eq function 'info)
+			(append args (list (generate-new-buffer-name "*info*"))) args))))
 
 ;; The doc string is meant to explain what buttons do.
 (defun help-follow-mouse ()