unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 9915@debbugs.gnu.org
Subject: bug#9915: 24.0.91; Info-hide-node-references does not take effect immediately
Date: Wed, 02 Nov 2011 11:45:51 +0200	[thread overview]
Message-ID: <87k47iyi0g.fsf@mail.jurta.org> (raw)
In-Reply-To: <87vcr3v7g5.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 01 Nov 2011 23:59:02 +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? "))






  reply	other threads:[~2011-11-02  9:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 11:47 bug#9915: 24.0.91; Info-hide-node-references does not take effect immediately Eli Zaretskii
2011-11-01  9:32 ` Juri Linkov
2011-11-01 11:18   ` Eli Zaretskii
2011-11-01 21:59     ` Juri Linkov
2011-11-02  9:45       ` Juri Linkov [this message]
2011-11-19 21:45         ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k47iyi0g.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=9915@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).