all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Editing change groups
@ 2018-11-09  7:52 Michael Heerdegen
  2018-11-09  8:39 ` Joost Kremers
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Michael Heerdegen @ 2018-11-09  7:52 UTC (permalink / raw)
  To: Emacs mailing list

Hello,

I have the following requirement for a user interface: if the user hits
a key, something in the buffer is replaced with something else.  Doing
this potentially involves several editing operations.  If the user hits
the same key again, the old contents are restored.

My question is: are change groups, as described in (info "(elisp) Atomic
Changes"), a suitable tool to do this?  AFAIK it works, but I must admit
I don't understand the implementation of change groups.  I tried to use
an example like

(defun my-test-change-groups ()
  (interactive)
  (insert "0\n")
  (let ((g (prepare-change-group)))
    (insert "a\n")
    (activate-change-group g)
    (insert "b\n")
    (insert "c\n")
    (cancel-change-group g)))

to see how things work but that doesn't work as I expected: calling the
command leaves all insertions intact as if the change group G hadn't
been canceled.  OTOH, if I remove the first insertion (insert "0\n")
from the example, calling the function causes nothing to be inserted at
all.

Seems I'm missing something?


Thanks,

Michael.



^ permalink raw reply	[flat|nested] 16+ messages in thread
[parent not found: <mailman.3697.1541749970.1284.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2018-11-11  8:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-09  7:52 Editing change groups Michael Heerdegen
2018-11-09  8:39 ` Joost Kremers
2018-11-09 11:58 ` Noam Postavsky
2018-11-09 12:39   ` Michael Heerdegen
2018-11-09 13:14     ` Eli Zaretskii
2018-11-09 13:12 ` Michael Heerdegen
2018-11-09 13:52 ` Stefan Monnier
2018-11-10  4:53   ` Michael Heerdegen
2018-11-10 13:15     ` Stefan Monnier
2018-11-10 16:23       ` Michael Heerdegen
2018-11-10 18:07         ` Stefan Monnier
2018-11-11  8:01           ` Michael Heerdegen
     [not found] <mailman.3697.1541749970.1284.help-gnu-emacs@gnu.org>
2018-11-09 11:41 ` Ben Bacarisse
2018-11-09 12:10   ` Michael Heerdegen
     [not found]   ` <mailman.3721.1541765458.1284.help-gnu-emacs@gnu.org>
2018-11-09 13:36     ` Ben Bacarisse
2018-11-09 13:58       ` Michael Heerdegen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.