unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to disable undo recording within a defun?
       [not found] <1511127682.419039.1631642669435.ref@mail.yahoo.com>
@ 2021-09-14 18:04 ` S Boucher via Users list for the GNU Emacs text editor
  2021-09-14 18:11   ` Óscar Fuentes
  0 siblings, 1 reply; 5+ messages in thread
From: S Boucher via Users list for the GNU Emacs text editor @ 2021-09-14 18:04 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

I'm writting a defun, and would like to disable entirely the recording of undo information while this function is executing.
Is this possible?  If so, what is the way to do this?
Thanks,


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

* Re: How to disable undo recording within a defun?
  2021-09-14 18:04 ` How to disable undo recording within a defun? S Boucher via Users list for the GNU Emacs text editor
@ 2021-09-14 18:11   ` Óscar Fuentes
  2021-09-16 23:41     ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 5+ messages in thread
From: Óscar Fuentes @ 2021-09-14 18:11 UTC (permalink / raw)
  To: S Boucher via Users list for the GNU Emacs text editor; +Cc: S Boucher

S Boucher via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> I'm writting a defun, and would like to disable entirely the recording
> of undo information while this function is executing. Is this
> possible?  If so, what is the way to do this? Thanks,

See function buffer-disable-undo and variable buffer-undo-list.



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

* Re: How to disable undo recording within a defun?
  2021-09-14 18:11   ` Óscar Fuentes
@ 2021-09-16 23:41     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-09-17  0:11       ` Michael Heerdegen
  2021-09-21 11:54       ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-09-16 23:41 UTC (permalink / raw)
  To: help-gnu-emacs

>> I'm writting a defun, and would like to disable entirely the recording
>> of undo information while this function is executing. Is this
>> possible?  If so, what is the way to do this? Thanks,
> See function buffer-disable-undo and variable buffer-undo-list.

It's very unusual to disable recording undo, and it is usually
problematic because the undo-records before and after the chunk you want
to skip can't be used together unless the chunk you skip ends up doing
"nothing".

So maybe you're looking for `with-silent-modifications` which can be
used when the modifications to the buffer are "negligible" (typically
in the sense that they don't affect what would get saved into the file).


        Stefan




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

* Re: How to disable undo recording within a defun?
  2021-09-16 23:41     ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-09-17  0:11       ` Michael Heerdegen
  2021-09-21 11:54       ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Heerdegen @ 2021-09-17  0:11 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> So maybe you're looking for `with-silent-modifications` which can be
> used when the modifications to the buffer are "negligible" (typically
> in the sense that they don't affect what would get saved into the file).

Another guess is that the OP wants multiple buffer changes to become a
single undo item.  Doable with change group amalgamating:

 (info "(elisp) Atomic Changes")

Michael.





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

* Re: How to disable undo recording within a defun?
  2021-09-16 23:41     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-09-17  0:11       ` Michael Heerdegen
@ 2021-09-21 11:54       ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 5+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-21 11:54 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier via Users list for the GNU Emacs text editor wrote:

> It's very unusual to disable recording undo, and it is
> usually problematic because the undo-records before and
> after the chunk you want to skip can't be used together
> unless the chunk you skip ends up doing "nothing".

Reminds me of world-finance.el where you can transfer huge
sums of money yet do some handy "undoing" in the middle and
most often people are so ignorant and busy anyway mostly up to
no good they don't notice the missing billion in between all
the same ...

-- 
underground experts united
https://dataswamp.org/~incal




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

end of thread, other threads:[~2021-09-21 11:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1511127682.419039.1631642669435.ref@mail.yahoo.com>
2021-09-14 18:04 ` How to disable undo recording within a defun? S Boucher via Users list for the GNU Emacs text editor
2021-09-14 18:11   ` Óscar Fuentes
2021-09-16 23:41     ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-09-17  0:11       ` Michael Heerdegen
2021-09-21 11:54       ` Emanuel Berg via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).