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

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

Re: How to temporarily show an image in an Emacs buffer?


From: Michael Heerdegen
Subject: Re: How to temporarily show an image in an Emacs buffer?
Date: Wed, 08 Mar 2023 17:41:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Marcin Borkowski <mbork@mbork.pl> writes:

> On 2023-03-08, at 05:53, Marcin Borkowski <mbork@mbork.pl> wrote:
>
> > Alternatively, it _may_ change the buffer contents but in a way that is
> > not recorded in `buffer-undo-list'.  Is that possible?
>
> I did some experimenting, and this
>
> (defvar no-undo-marker (make-marker))
> (defun no-undo-insert ()
>   "Test undo."
>   (save-excursion
>     (let ((buffer-undo-list))
>       (set-marker no-undo-marker (point))
>       (insert "this can't be undone\n"))))
> [...]

Regardless of what has already been said, just for the sake of
completeness: AFAIK the intended way to inhibit the recording of undo
is to bind buffer-undo-list to t (not to nil).

There are lots of use case in the sources - see e.g.
`image-toggle-display-text'.

Michael.




reply via email to

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