help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Reverting but keeping undo


From: Dan Espen
Subject: Re: Reverting but keeping undo
Date: Thu, 30 May 2013 21:21:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I assume this change kills off the old confirmation about reverting.
>
> No, it doesn't.  I never made the connection between the two in
> my mind.  But I think you're on to something.
>
> FWIW, here's what I use for the revert-buffer confirmation:
>
> (advice-add 'revert-buffer :before
>             (lambda (&rest _)
>               (interactive (list (not current-prefix-arg)
>                                  ;; Don't request confirmation if the
>                                  ;; user just hit M-x revert-buffer RET.
>                                  (eq last-command-event ?\r)))
>               nil))

Sorry for the previous typo which I just noticed, I meant to type:

"First Stefan thanks for the explanation."

I just used:

(defun my-revert()
  (interactive)
  (message "Reverting buffer from %s" buffer-file-name)
  (revert-buffer nil 1)
  (message "Done"))

and bound it to a key.


With undo for reverts, I can't think of a good reason for the
confirmation.  Some kind of notice in the mini buffer is still
a good idea.


-- 
Dan Espen


reply via email to

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