[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: |
Wed, 08 Mar 2023 06:23:45 +0100 |
User-agent: |
mu4e 1.1.0; emacs 30.0.50 |
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"))))
(defun no-undo-uninsert ()
(save-excursion
(goto-char no-undo-marker)
(let ((buffer-undo-list))
(when (looking-at-p "this can't be undone\n")
(delete-char 21)))))
seems to do the trick, but depending on the order of typing and calling
these functions, the undo list becomes corrupted (I get "primitive-undo:
Changes to be undone are outside visible portion of buffer").
Any hints?
--
Marcin Borkowski
http://mbork.pl
Re: How to temporarily show an image in an Emacs buffer?, Eli Zaretskii, 2023/03/08