emacs-devel
[Top][All Lists]
Advanced

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

info reversion: almost but not qui{te,et}


From: Thien-Thi Nguyen
Subject: info reversion: almost but not qui{te,et}
Date: Mon, 10 Sep 2007 11:07:07 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

there is some support for reverting an info buffer:

 ;; 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 only for the
 ;; benefit of makeinfo-buffer) out of the way of normal operations.
 ;;
 (defun Info-revert-find-node (filename nodename) ...)

but that does not use the conventional `revert-buffer-function' dispatch
so here is a sketch that does:

 (defun Info-revert (ignore-auto noconfirm)
   (when (or noconfirm (y-or-n-p "Revert info buffer? "))
     (let ((filename Info-current-file)
           (node Info-current-node)
           (line (count-lines (point-min) (line-beginning-position)))
           (inhibit-read-only t))
       (erase-buffer)
       (Info-revert-find-node filename node)
       (message "Reverted %s" filename)
       (redisplay)
       (forward-line line))))
 
 (add-hook 'Info-mode-hook
           (lambda ()
             (set (make-local-variable 'revert-buffer-function)
                  Info-revert)))

this gives ok results but having to call `redisplay' annoys me (as
programmer: "inelegant!", as user: "bogus flashing!").  when i omit that
call, however, the `forward-line' seems to have no effect.  why would
that be?

thi




reply via email to

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