[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: disabling undo boundaries
From: |
Phillip Lord |
Subject: |
Re: disabling undo boundaries |
Date: |
Wed, 20 May 2015 08:45:50 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>>> Could you describe the exact case that bothers you, so we could start by
>>> thinking what should be the ideal behavior for that one?
>> Yes. Any after-change-function that changes another buffer breaks undo.
>> My "noisy-change" package which just logs the before and
>> after-change-function args is an example of this.
>> https://raw.githubusercontent.com/phillord/lentic/master/noisy-change.el
>> My real use case is lentic.
>> Ideal behaviour: is just not to do it. Uncommenting all the
>> "undo_boundary" calls in undo.c seems to achieve this for me, although
>> obviously that's a blunt fix.
>
> Could you be more specific. Give a very concrete example of a sequence
> of commands, and then explain which the undo-boundaries end up being and
> what they should be instead.
Yes, okay.
So, in *scratch* I remove comments from the second and third line and
put everything onto one line.
;; This buffer is for notes you don't want to save, and for Lisp evaluation. If
you want to create a file, visit that file with C-x C-f, then enter the text in
that file's own buffer.
I load noisy-change.el (but not enable it).
(setq buffer-undo-list nil)
M-x fill-paragraph (with point on the one line)
(nil
(156 . 159)
(#(" " 0 1
(fontified nil face
(whitespace-line font-lock-comment-face)))
. -156)
(nil face nil 155 . 156)
(155 . 156)
(78 . 81)
(#(" " 0 1
(fontified nil face font-lock-comment-face))
. -78)
(#<marker
(moves after insertion)
at 81 in *scratch*> . 1)
(#<marker
(moves after insertion)
at 81 in *scratch*> . 1)
(#<marker
(moves after insertion)
at 81 in *scratch*> . 1)
(#<marker
(moves after insertion)
at 81 in *scratch*> . 1)
(nil face nil 77 . 78)
(77 . 78))
M-x undo
(setq noisy-change-undo t)
(setq buffer-undo-list nil)
M-x fill-paragraph
(nil
(156 . 159)
nil
(#(" " 0 1
(fontified nil face
(whitespace-line font-lock-comment-face)))
. -156)
nil
(nil face nil 155 . 156)
nil
(155 . 156)
nil
(78 . 81)
nil
(#(" " 0 1
(fontified nil face font-lock-comment-face))
. -78)
nil
(nil face nil 77 . 78)
nil
(77 . 78))
At my count it takes 8 undo operations to undo "fill-paragraph".
Obviously, a longer paragraph will take more operations.
Phil
- Re: disabling undo boundaries, (continued)
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/14
- Re: disabling undo boundaries, Phillip Lord, 2015/05/15
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/15
- Re: disabling undo boundaries, Phillip Lord, 2015/05/15
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/15
- Re: disabling undo boundaries, Phillip Lord, 2015/05/16
- Re: disabling undo boundaries, Phillip Lord, 2015/05/19
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/19
- Re: disabling undo boundaries, Phillip Lord, 2015/05/19
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/19
- Re: disabling undo boundaries,
Phillip Lord <=
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/20
- Re: disabling undo boundaries, Phillip Lord, 2015/05/21
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/21
- Re: disabling undo boundaries, Phillip Lord, 2015/05/21
- Re: disabling undo boundaries, Phillip Lord, 2015/05/27