all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: after-find-file-from-revert-buffer
Date: Wed, 06 Apr 2011 12:51:55 -0400	[thread overview]
Message-ID: <jwvzko3tjep.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <BANLkTik7q6oFZ4Xc19qpTkM8csO=NMMtpQ@mail.gmail.com> (Juanma Barranquero's message of "Wed, 6 Apr 2011 17:18:33 +0200")

> 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



  reply	other threads:[~2011-04-06 16:51 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   ` after-find-file-from-revert-buffer Juanma Barranquero
2011-04-06 16:51     ` Stefan Monnier [this message]
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=jwvzko3tjep.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    /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.