diff options
| author | Juri Linkov | 2011-11-19 23:43:40 +0200 |
|---|---|---|
| committer | Juri Linkov | 2011-11-19 23:43:40 +0200 |
| commit | 3ffbc301c09e6d2a33e3f717d6c55afc9ed6b221 (patch) | |
| tree | 16a821d142e6d92bb764c1950ad561310065fa05 | |
| parent | 30c621331d969093bf618ba4fb9a8cc0a14edfe7 (diff) | |
| download | emacs-3ffbc301c09e6d2a33e3f717d6c55afc9ed6b221.tar.gz emacs-3ffbc301c09e6d2a33e3f717d6c55afc9ed6b221.zip | |
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
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2011-11-19 Juri Linkov <juri@jurta.org> | 1 | 2011-11-19 Juri Linkov <juri@jurta.org> |
| 2 | 2 | ||
| 3 | * info.el (Info-hide-note-references): Add `:set' tag to `defcustom' | ||
| 4 | that calls `revert-buffer' on all Info buffers. (Bug#9915) | ||
| 5 | (Info-revert-find-node): Remove let-bindings `old-buffer-name', | ||
| 6 | `old-history', `old-history-forward'. Add let-binding | ||
| 7 | `window-selected'. Remove calls to `kill-buffer', | ||
| 8 | `switch-to-buffer' and `Info-mode'. Set `Info-current-file' to nil | ||
| 9 | before calling `Info-find-node', so `Info-find-node-2' will reread | ||
| 10 | the Info file. Restore window positions only when `window-selected' | ||
| 11 | is non-nil. | ||
| 12 | |||
| 13 | 2011-11-19 Juri Linkov <juri@jurta.org> | ||
| 14 | |||
| 3 | * isearch.el (isearch-lazy-highlight-new-loop): | 15 | * isearch.el (isearch-lazy-highlight-new-loop): |
| 4 | Remove condition `(not isearch-error)'. (Bug#9918) | 16 | Remove condition `(not isearch-error)'. (Bug#9918) |
| 5 | 17 | ||
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'." | |||
| 231 | (const :tag "Replace tag and hide reference" t) | 231 | (const :tag "Replace tag and hide reference" t) |
| 232 | (const :tag "Hide tag and reference" hide) | 232 | (const :tag "Hide tag and reference" hide) |
| 233 | (other :tag "Only replace tag" tag)) | 233 | (other :tag "Only replace tag" tag)) |
| 234 | :set (lambda (sym val) | ||
| 235 | (set sym val) | ||
| 236 | (dolist (buffer (buffer-list)) | ||
| 237 | (with-current-buffer buffer | ||
| 238 | (when (eq major-mode 'Info-mode) | ||
| 239 | (revert-buffer t t))))) | ||
| 234 | :group 'info) | 240 | :group 'info) |
| 235 | 241 | ||
| 236 | (defcustom Info-refill-paragraphs nil | 242 | (defcustom Info-refill-paragraphs nil |
| @@ -811,10 +817,6 @@ otherwise, that defaults to `Top'." | |||
| 811 | (concat default-directory (buffer-name)))) | 817 | (concat default-directory (buffer-name)))) |
| 812 | (Info-find-node-2 nil nodename)) | 818 | (Info-find-node-2 nil nodename)) |
| 813 | 819 | ||
| 814 | ;; It's perhaps a bit nasty to kill the *info* buffer to force a re-read, | ||
| 815 | ;; but at least it keeps this routine (which is for makeinfo-buffer and | ||
| 816 | ;; Info-revert-buffer-function) out of the way of normal operations. | ||
| 817 | ;; | ||
| 818 | (defun Info-revert-find-node (filename nodename) | 820 | (defun Info-revert-find-node (filename nodename) |
| 819 | "Go to an Info node FILENAME and NODENAME, re-reading disk contents. | 821 | "Go to an Info node FILENAME and NODENAME, re-reading disk contents. |
| 820 | When *info* is already displaying FILENAME and NODENAME, the window position | 822 | When *info* is already displaying FILENAME and NODENAME, the window position |
| @@ -822,27 +824,23 @@ is preserved, if possible." | |||
| 822 | (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) | 824 | (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) |
| 823 | (let ((old-filename Info-current-file) | 825 | (let ((old-filename Info-current-file) |
| 824 | (old-nodename Info-current-node) | 826 | (old-nodename Info-current-node) |
| 825 | (old-buffer-name (buffer-name)) | 827 | (window-selected (eq (selected-window) (get-buffer-window))) |
| 826 | (pcolumn (current-column)) | 828 | (pcolumn (current-column)) |
| 827 | (pline (count-lines (point-min) (line-beginning-position))) | 829 | (pline (count-lines (point-min) (line-beginning-position))) |
| 828 | (wline (count-lines (point-min) (window-start))) | 830 | (wline (count-lines (point-min) (window-start))) |
| 829 | (old-history-forward Info-history-forward) | ||
| 830 | (old-history Info-history) | ||
| 831 | (new-history (and Info-current-file | 831 | (new-history (and Info-current-file |
| 832 | (list Info-current-file Info-current-node (point))))) | 832 | (list Info-current-file Info-current-node (point))))) |
| 833 | (kill-buffer (current-buffer)) | 833 | ;; When `Info-current-file' is nil, `Info-find-node-2' rereads the file. |
| 834 | (switch-to-buffer (or old-buffer-name "*info*")) | 834 | (setq Info-current-file nil) |
| 835 | (Info-mode) | ||
| 836 | (Info-find-node filename nodename) | 835 | (Info-find-node filename nodename) |
| 837 | (setq Info-history-forward old-history-forward) | ||
| 838 | (setq Info-history old-history) | ||
| 839 | (if (and (equal old-filename Info-current-file) | 836 | (if (and (equal old-filename Info-current-file) |
| 840 | (equal old-nodename Info-current-node)) | 837 | (equal old-nodename Info-current-node)) |
| 841 | (progn | 838 | (progn |
| 842 | ;; note goto-line is no good, we want to measure from point-min | 839 | ;; note goto-line is no good, we want to measure from point-min |
| 843 | (goto-char (point-min)) | 840 | (when window-selected |
| 844 | (forward-line wline) | 841 | (goto-char (point-min)) |
| 845 | (set-window-start (selected-window) (point)) | 842 | (forward-line wline) |
| 843 | (set-window-start (selected-window) (point))) | ||
| 846 | (goto-char (point-min)) | 844 | (goto-char (point-min)) |
| 847 | (forward-line pline) | 845 | (forward-line pline) |
| 848 | (move-to-column pcolumn)) | 846 | (move-to-column pcolumn)) |