1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

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
This commit is contained in:
Juri Linkov 2011-11-19 23:43:40 +02:00
parent 30c621331d
commit 3ffbc301c0
2 changed files with 25 additions and 15 deletions

View File

@ -1,3 +1,15 @@
2011-11-19 Juri Linkov <juri@jurta.org>
* 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 <juri@jurta.org>
* isearch.el (isearch-lazy-highlight-new-loop):

View File

@ -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))