From 3ffbc301c09e6d2a33e3f717d6c55afc9ed6b221 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sat, 19 Nov 2011 23:43:40 +0200 Subject: [PATCH] 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. Fixes: debbugs:9915 --- lisp/ChangeLog | 12 ++++++++++++ lisp/info.el | 28 +++++++++++++--------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c66d9c6112c..fb28caeffbe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,17 @@ 2011-11-19 Juri Linkov + * 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 + * isearch.el (isearch-lazy-highlight-new-loop): Remove condition `(not isearch-error)'. (Bug#9918) diff --git a/lisp/info.el b/lisp/info.el index 338f6cb5e65..8af1bb04f90 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -231,6 +231,12 @@ want to set `Info-refill-paragraphs'." (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 @@ otherwise, that defaults to `Top'." (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 @@ is preserved, if possible." (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)) -- 2.11.4.GIT