[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: after-find-file-from-revert-buffer
From: |
Stefan Monnier |
Subject: |
Re: after-find-file-from-revert-buffer |
Date: |
Wed, 06 Apr 2011 12:51:55 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> The issue is that saveplace does not need or want a
> revert-buffer-function. What it wants is to piggyback on
> find-file-hook to restore the point in other buffers, but detect the
> cases where that's caused by revert-buffer, to avoid unexpectedly
> moving the point.
I was thinking of using a revert-buffer-function of the form
(λ (&rest args)
(let ((save-place-in-revert-buffer t))
(apply revert-buffer-default args)))
> (defun revert-buffer (...)
> (let ((revert-buffer-in-progress t))
> ...))
> which isn't not much better that which we have today, but at least is
> better focused: it's cleaner to have a flag to signal use of
> revert-buffer, than one to signal use of after-find-file inside
> revert-buffer...
Yes, that's is better.
> @@ -5047,8 +5048,10 @@
> (interactive (list (not current-prefix-arg)))
> (if revert-buffer-function
> - (funcall revert-buffer-function ignore-auto noconfirm)
> + (let ((revert-buffer-in-progress-p t))
> + (funcall revert-buffer-function ignore-auto noconfirm))
> (with-current-buffer (or (buffer-base-buffer (current-buffer))
> (current-buffer))
> - (let* ((auto-save-p (and (not ignore-auto)
> + (let* ((revert-buffer-in-progress-p t)
> + (auto-save-p (and (not ignore-auto)
> (recent-auto-save-p)
> buffer-auto-save-file-name
I guess you could use a single let that covers both branches of the `if'.
Stefan