From: Juanma Barranquero <lekktu@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: after-find-file-from-revert-buffer
Date: Wed, 6 Apr 2011 17:18:33 +0200 [thread overview]
Message-ID: <BANLkTik7q6oFZ4Xc19qpTkM8csO=NMMtpQ@mail.gmail.com> (raw)
In-Reply-To: <jwv39lww4dj.fsf-monnier+emacs@gnu.org>
> Removing the variable sounds like the best option. So the question is
> how to get the same behavior in saveplace without using this variable.
> Maybe saveplace could setup a local revert-buffer-function instead.
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.
If the (before|after)-revert-hooks were always run, we could try to
use these (though it would be ugly); but a `revert-buffer-function' is
free to ignore them.
On the other hand, if the `revert-buffer-function' does not call
`after-find-file', or if it does but does not pass the
AFTER-FIND-FILE-FROM-REVERT-BUFFER parameter, the saveplace hook isn't
detecting the revert-buffer call anyway...
The only answer I can think is having something like
after-find-file-from-revert-buffer, but explicitly for revert-buffer:
(defvar revert-buffer-in-progress-p nil
"This variable is non-nil whenever a `revert-buffer' operation is
in progress, nil otherwise.")
(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...
Juanma
P.S. Well, it would be more like
@@ -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
next prev parent reply other threads:[~2011-04-06 15:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-06 0:28 after-find-file-from-revert-buffer Juanma Barranquero
2011-04-06 1:34 ` after-find-file-from-revert-buffer Stefan Monnier
2011-04-06 1:42 ` after-find-file-from-revert-buffer Juanma Barranquero
2011-04-06 15:17 ` after-find-file-from-revert-buffer Stefan Monnier
2011-04-06 17:43 ` after-find-file-from-revert-buffer Juanma Barranquero
2011-04-06 15:18 ` Juanma Barranquero [this message]
2011-04-06 16:51 ` after-find-file-from-revert-buffer Stefan Monnier
2011-04-06 17:03 ` after-find-file-from-revert-buffer Juanma Barranquero
2011-04-06 17:32 ` after-find-file-from-revert-buffer Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTik7q6oFZ4Xc19qpTkM8csO=NMMtpQ@mail.gmail.com' \
--to=lekktu@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.