emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106435: Don't kill the *info* buffer


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106435: Don't kill the *info* buffer in `Info-revert-find-node'.
Date: Sat, 19 Nov 2011 23:43:40 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106435
fixes bug(s): http://debbugs.gnu.org/9915
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Sat 2011-11-19 23:43:40 +0200
message:
  Don't kill the *info* buffer in `Info-revert-find-node'.
  Add `revert-buffer' to defcustom `Info-hide-node-references'.
  
  * lisp/info.el (Info-hide-note-references): Add `:set' tag to `defcustom'
  that calls `revert-buffer' on all Info buffers. 
  (Info-revert-find-node): Remove let-bindings `old-buffer-name',
  `old-history', `old-history-forward'.  Add let-binding
  `window-selected'.  Remove calls to `kill-buffer',
  `switch-to-buffer' and `Info-mode'.  Set `Info-current-file' to nil
  before calling `Info-find-node', so `Info-find-node-2' will reread
  the Info file.  Restore window positions only when `window-selected'
  is non-nil.
modified:
  lisp/ChangeLog
  lisp/info.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-11-19 21:03:12 +0000
+++ b/lisp/ChangeLog    2011-11-19 21:43:40 +0000
@@ -1,5 +1,17 @@
 2011-11-19  Juri Linkov  <address@hidden>
 
+       * info.el (Info-hide-note-references): Add `:set' tag to `defcustom'
+       that calls `revert-buffer' on all Info buffers.  (Bug#9915)
+       (Info-revert-find-node): Remove let-bindings `old-buffer-name',
+       `old-history', `old-history-forward'.  Add let-binding
+       `window-selected'.  Remove calls to `kill-buffer',
+       `switch-to-buffer' and `Info-mode'.  Set `Info-current-file' to nil
+       before calling `Info-find-node', so `Info-find-node-2' will reread
+       the Info file.  Restore window positions only when `window-selected'
+       is non-nil.
+
+2011-11-19  Juri Linkov  <address@hidden>
+
        * isearch.el (isearch-lazy-highlight-new-loop):
        Remove condition `(not isearch-error)'.  (Bug#9918)
 

=== modified file 'lisp/info.el'
--- a/lisp/info.el      2011-11-19 21:03:12 +0000
+++ b/lisp/info.el      2011-11-19 21:43:40 +0000
@@ -231,6 +231,12 @@
                 (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 +817,6 @@
           (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,27 +824,23 @@
   (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)
+    ;; When `Info-current-file' is nil, `Info-find-node-2' rereads the file.
+    (setq Info-current-file nil)
     (Info-find-node filename nodename)
-    (setq Info-history-forward old-history-forward)
-    (setq Info-history old-history)
     (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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]