unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* `after-change-functions' and undo
@ 2004-11-27 23:43 Paul Pogonyshev
  2004-11-28 11:48 ` David Kastrup
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Pogonyshev @ 2004-11-27 23:43 UTC (permalink / raw)


Hi.

I'm having a problem with `after-change-functions' and undo
interference.  My `after-change' hook does magic things to
allow special property inheritance.  So, it can set certain
text properties on an inserted text chunk.

Everything works fine till I start undoing in the buffer.
It seems that `after-change' hook is invoked and, when
undoing a deletion, it sees an insertion and happily starts
mangling text properties.

So, the question is: can I prevent my `after-change' hook
from running while undo is in effect?  I couldn't figure out
from the manual.

Paul

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

* Re: `after-change-functions' and undo
  2004-11-27 23:43 `after-change-functions' and undo Paul Pogonyshev
@ 2004-11-28 11:48 ` David Kastrup
  2004-11-28 14:51   ` Paul Pogonyshev
  0 siblings, 1 reply; 4+ messages in thread
From: David Kastrup @ 2004-11-28 11:48 UTC (permalink / raw)
  Cc: emacs-devel

Paul Pogonyshev <pogonyshev@gmx.net> writes:

> I'm having a problem with `after-change-functions' and undo
> interference.
>
> So, the question is: can I prevent my `after-change' hook
> from running while undo is in effect?  I couldn't figure out
> from the manual.

undo-in-progress's value is nil

Non-nil while performing an undo.
Some change-hooks test this variable to do something different.

Defined in `simple'.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: `after-change-functions' and undo
  2004-11-28 11:48 ` David Kastrup
@ 2004-11-28 14:51   ` Paul Pogonyshev
  2004-11-29  6:11     ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Pogonyshev @ 2004-11-28 14:51 UTC (permalink / raw)
  Cc: emacs-devel

David Kastrup wrote:
> Paul Pogonyshev <pogonyshev@gmx.net> writes:
> > I'm having a problem with `after-change-functions' and undo
> > interference.
> >
> > So, the question is: can I prevent my `after-change' hook
> > from running while undo is in effect?  I couldn't figure out
> > from the manual.
>
> undo-in-progress's value is nil
>
> Non-nil while performing an undo.
> Some change-hooks test this variable to do something different.
>
> Defined in `simple'.

That's exactly what I was looking for, thank you.

Maybe it should be added to the Elisp manual?  I can do this,
but I'm not sure where to add the description.

Paul

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

* Re: `after-change-functions' and undo
  2004-11-28 14:51   ` Paul Pogonyshev
@ 2004-11-29  6:11     ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2004-11-29  6:11 UTC (permalink / raw)
  Cc: emacs-devel

I will add this.  Thanks.

*** text.texi	23 Oct 2004 00:52:51 -0400	1.79
--- text.texi	28 Nov 2004 19:53:10 -0500	
***************
*** 1244,1249 ****
--- 1244,1255 ----
  undo individual replacements one by one.
  @end defun
  
+ @defvar undo-in-progress
+ This variable is normally @code{nil}, but the undo commands bind it to
+ @code{t}.  This is so that various kinds of change hooks can tell when
+ they're being called for the sake of undoing.
+ @end defvar
+ 
  @defun primitive-undo count list
  This is the basic function for undoing elements of an undo list.
  It undoes the first @var{count} elements of @var{list}, returning

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

end of thread, other threads:[~2004-11-29  6:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-27 23:43 `after-change-functions' and undo Paul Pogonyshev
2004-11-28 11:48 ` David Kastrup
2004-11-28 14:51   ` Paul Pogonyshev
2004-11-29  6:11     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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