all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Reverting but keeping undo
@ 2013-05-15 10:38 Óscar Fuentes
  2013-05-16  5:29 ` W. Greenhouse
  2013-05-29  1:52 ` Stefan Monnier
  0 siblings, 2 replies; 31+ messages in thread
From: Óscar Fuentes @ 2013-05-15 10:38 UTC (permalink / raw
  To: help-gnu-emacs

`revert-buffer' discards undo history. I can understand that undo
history might be in conflict with the new contents of the buffer. How
dangerous is that? Apart from that, what could be wrong with using the
recipe published in

http://www.emacswiki.org/emacs/RevertBuffer#toc4

?

For your convenience, this is the recipe:

(defun revert-buffer-keep-undo (&rest -)
  "Revert buffer but keep undo history."
  (interactive)
  (let ((inhibit-read-only t))
    (erase-buffer)
    (insert-file-contents (buffer-file-name))
    (set-visited-file-modtime (visited-file-modtime))
    (set-buffer-modified-p nil)))

Install in command ‘revert-buffer’ with

  (setq revert-buffer-function 'revert-buffer-keep-undo)




^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: Reverting but keeping undo
@ 2013-05-31 16:49 Barry OReilly
  0 siblings, 0 replies; 31+ messages in thread
From: Barry OReilly @ 2013-05-31 16:49 UTC (permalink / raw
  To: help-gnu-emacs

> To be clear: I don't want an additional prompt for confirmation,
> just a short message in the minibuffer, like
>
> [Undo: undoing `revert-buffer']
>
> Because there are cases when the user (I) would want to stop at that
> point.

I don't see why revert-buffer would be singled out, since many
different commands cause buffer changes.

If it were implemented, it may be better to generalize it to allow
any undo to have an annotation of what caused the change. Then the
user would set a defcustom for whether to echo an undo's annotation
while undoing. I could foresee Undo Tree's visualization displaying
the annotation next to its nodes.


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2013-05-31 18:29 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15 10:38 Reverting but keeping undo Óscar Fuentes
2013-05-16  5:29 ` W. Greenhouse
2013-05-16 15:10   ` Óscar Fuentes
2013-05-29  1:52 ` Stefan Monnier
2013-05-29  3:09   ` Drew Adams
2013-05-29  3:27     ` Dmitry Gutov
2013-05-29  5:13       ` Drew Adams
2013-05-29 12:26         ` Dmitry Gutov
2013-05-29 13:55           ` Drew Adams
2013-05-29 15:21             ` Dmitry Gutov
2013-05-29 16:33               ` Drew Adams
2013-05-29 17:51                 ` Dmitry Gutov
     [not found]               ` <mailman.605.1369845207.22516.help-gnu-emacs@gnu.org>
2013-05-29 18:42                 ` Dan Espen
2013-05-29 13:48         ` Stefan Monnier
     [not found]       ` <mailman.562.1369804408.22516.help-gnu-emacs@gnu.org>
2013-05-29 13:25         ` Dan Espen
2013-05-29 16:26           ` Drew Adams
2013-05-30 18:48           ` Michael Heerdegen
2013-05-30 18:41   ` Michael Heerdegen
2013-05-30 19:19     ` Óscar Fuentes
2013-05-30 21:26     ` Stefan Monnier
2013-05-30 22:05       ` Michael Heerdegen
     [not found]       ` <mailman.728.1369951538.22516.help-gnu-emacs@gnu.org>
2013-05-30 23:59         ` Dan Espen
2013-05-31  0:58           ` Stefan Monnier
     [not found]           ` <mailman.738.1369961954.22516.help-gnu-emacs@gnu.org>
2013-05-31  1:21             ` Dan Espen
2013-05-31  2:28               ` Drew Adams
2013-05-31 16:05           ` Michael Heerdegen
2013-05-31 18:29             ` Óscar Fuentes
     [not found]           ` <mailman.767.1370016367.22516.help-gnu-emacs@gnu.org>
2013-05-31 17:22             ` Dan Espen
2013-05-31 18:08               ` Barry Margolin
     [not found]   ` <mailman.699.1369939338.22516.help-gnu-emacs@gnu.org>
2013-05-30 18:45     ` Barry Margolin
  -- strict thread matches above, loose matches on Subject: below --
2013-05-31 16:49 Barry OReilly

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.