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: Marcin Borkowski
Subject: Re: How to temporarily show an image in an Emacs buffer?
Date: Sat, 11 Mar 2023 09:14:07 +0100
User-agent: mu4e 1.1.0; emacs 30.0.50

On 2023-03-08, at 17:41, Michael Heerdegen <michael_heerdegen@web.de> wrote:

> 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).

Thanks, I missed that.

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

I didn't experiment with this, but I'm afraid that interlacing changes
to the buffer done by the user (when recording undo changes) and by the
Elisp code (while `buffer-undo-list' is bound to `t') may result in
undoing being impossible.

Anyway, I solved /my/ particular problem using overlays.  Thanks!

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

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