emacs-devel
[Top][All Lists]
Advanced

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

Re: Refreshing Info nodes


From: Juri Linkov
Subject: Re: Refreshing Info nodes
Date: Wed, 16 Jun 2010 23:33:08 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

> I'd rather check something more directly and explicitly related to
> reverting that just (derived-mode-p 'Info-mode).  Ideally there should
> be no check: the code that does the pop-to-buffer should simply not be
> used at all when reverting, instead the non-reverting case should create
> a *info* buffer, setup the few needed vars and then trigger
> `revert-buffer' to do the actual work.

Reverting in Info is implemented by the function `Info-revert-find-node'
whose purpose is to go to an Info node (like `Info-find-node'),
by killing the original buffer and creating a new one.

This is peculiar, but I'd like to avoid reimplementing this mechanism to
keep the traditional behavior, and simply fix a bug to allow it to work
with buffer names other than the default "*info*":

=== modified file 'lisp/info.el'
--- lisp/info.el        2010-06-10 16:42:56 +0000
+++ lisp/info.el        2010-06-16 20:27:42 +0000
@@ -803,9 +803,10 @@ (defun Info-revert-find-node (filename n
   "Go to an Info node FILENAME and NODENAME, re-reading disk contents.
 When *info* is already displaying FILENAME and NODENAME, the window position
 is preserved, if possible."
-  (pop-to-buffer "*info*")
+  (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
   (let ((old-filename Info-current-file)
        (old-nodename Info-current-node)
+       (old-buffer-name (buffer-name))
        (pcolumn      (current-column))
        (pline        (count-lines (point-min) (line-beginning-position)))
        (wline        (count-lines (point-min) (window-start)))
@@ -813,6 +814,8 @@ (defun Info-revert-find-node (filename n
        (new-history  (and Info-current-file
                           (list Info-current-file Info-current-node (point)))))
     (kill-buffer (current-buffer))
+    (pop-to-buffer (or old-buffer-name "*info*"))
+    (Info-mode)
     (Info-find-node filename nodename)
     (setq Info-history old-history)
     (if (and (equal old-filename Info-current-file)

-- 
Juri Linkov
http://www.jurta.org/emacs/



reply via email to

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