GNU bug report logs - #9915
24.0.91; Info-hide-node-references does not take effect immediately

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Mon, 31 Oct 2011 11:50:01 UTC

Severity: normal

Tags: patch

Found in version 24.0.91

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


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

From: Juri Linkov <juri <at> jurta.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9915 <at> debbugs.gnu.org
Subject: Re: bug#9915: 24.0.91;
	Info-hide-node-references does not take effect immediately
Date: Wed, 02 Nov 2011 11:45:51 +0200
> This is due to the peculiarity of the implementation of
> `Info-revert-find-node' that kills the *Info* buffer to revert it.
> Its comment says:
>
>   ;; It's perhaps a bit nasty to kill the *info* buffer to force a re-read,
>   ;; but at least it keeps this routine (which is for makeinfo-buffer and
>   ;; Info-revert-buffer-function) out of the way of normal operations.
>
> It has other nasty effects when used in defcustom, e.g. when
> *Info* buffers are displayed in different windows, it will mess up
> the window configuration.  I think `Info-revert-find-node' should
> be rewritten to not kill the *Info* buffer, but I'm not sure
> whether this is need for 24.1.

This should be fixed with the following patch that doesn't kill the
*Info* buffer.  I tested it with `M-x makeinfo-buffer RET', with `M-x
revert-buffer RET' and with customizing `Info-hide-node-references'.

=== modified file 'lisp/info.el'
--- lisp/info.el	2011-10-24 05:47:05 +0000
+++ lisp/info.el	2011-11-02 09:43:59 +0000
@@ -231,6 +231,12 @@ (defcustom Info-hide-note-references t
 		 (const :tag "Replace tag and hide reference" t)
 		 (const :tag "Hide tag and reference" hide)
 		 (other :tag "Only replace tag" tag))
+  :set (lambda (sym val)
+	 (set sym val)
+	 (dolist (buffer (buffer-list))
+	   (with-current-buffer buffer
+	     (when (eq major-mode 'Info-mode)
+	       (revert-buffer t t)))))
   :group 'info)
 
 (defcustom Info-refill-paragraphs nil
@@ -811,10 +822,6 @@ (defun Info-on-current-buffer (&optional
 	   (concat default-directory (buffer-name))))
   (Info-find-node-2 nil nodename))
 
-;; It's perhaps a bit nasty to kill the *info* buffer to force a re-read,
-;; but at least it keeps this routine (which is for makeinfo-buffer and
-;; Info-revert-buffer-function) out of the way of normal operations.
-;;
 (defun Info-revert-find-node (filename nodename)
   "Go to an Info node FILENAME and NODENAME, re-reading disk contents.
 When *info* is already displaying FILENAME and NODENAME, the window position
@@ -822,33 +829,24 @@ (defun Info-revert-find-node (filename n
   (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*"))
   (let ((old-filename Info-current-file)
 	(old-nodename Info-current-node)
-	(old-buffer-name (buffer-name))
+	(window-selected (eq (selected-window) (get-buffer-window)))
 	(pcolumn      (current-column))
 	(pline        (count-lines (point-min) (line-beginning-position)))
-	(wline        (count-lines (point-min) (window-start)))
-	(old-history-forward Info-history-forward)
-	(old-history  Info-history)
-	(new-history  (and Info-current-file
-			   (list Info-current-file Info-current-node (point)))))
-    (kill-buffer (current-buffer))
-    (switch-to-buffer (or old-buffer-name "*info*"))
-    (Info-mode)
-    (Info-find-node filename nodename)
-    (setq Info-history-forward old-history-forward)
-    (setq Info-history old-history)
+	(wline        (count-lines (point-min) (window-start))))
+    ;; When `Info-current-file' is nil, `Info-find-node-2' rereads the file.
+    (setq Info-current-file nil)
+    (Info-find-node filename nodename t)
     (if (and (equal old-filename Info-current-file)
 	     (equal old-nodename Info-current-node))
 	(progn
 	  ;; note goto-line is no good, we want to measure from point-min
-	  (goto-char (point-min))
-	  (forward-line wline)
-	  (set-window-start (selected-window) (point))
+	  (when window-selected
+	    (goto-char (point-min))
+	    (forward-line wline)
+	    (set-window-start (selected-window) (point)))
 	  (goto-char (point-min))
 	  (forward-line pline)
-	  (move-to-column pcolumn))
-      ;; only add to the history when coming from a different file+node
-      (if new-history
-	  (setq Info-history (cons new-history Info-history))))))
+	  (move-to-column pcolumn)))))
 
 (defun Info-revert-buffer-function (_ignore-auto noconfirm)
   (when (or noconfirm (y-or-n-p "Revert info buffer? "))





This bug report was last modified 13 years and 183 days ago.

Previous Next


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