* Scary undo
@ 2008-05-06 10:04 Lennart Borgman (gmail)
2008-05-06 10:11 ` Juanma Barranquero
2008-05-06 10:15 ` David Kastrup
0 siblings, 2 replies; 4+ messages in thread
From: Lennart Borgman (gmail) @ 2008-05-06 10:04 UTC (permalink / raw)
To: Emacs Devel
I would like to undo a change made by a function that I call with
funcall. I do not know exactly what the function does, but hopefully it
will only indent the current line. However the new indentation might be
wrong.
The scenario is something like this
(funcall the-indentation-function)
(when (= 0 (current-indentation))
;; undo what `the-indentation-function' did,
;; but how?
)
I am a bit scared of writing this undo part so if someone could help me
I would be glad. I do not think I can use `undo-boundary' here.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Scary undo
2008-05-06 10:04 Scary undo Lennart Borgman (gmail)
@ 2008-05-06 10:11 ` Juanma Barranquero
2008-05-06 10:15 ` David Kastrup
1 sibling, 0 replies; 4+ messages in thread
From: Juanma Barranquero @ 2008-05-06 10:11 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Devel
> I would like to undo a change made by a function that I call with funcall. I
> do not know exactly what the function does, but hopefully it will only
> indent the current line. However the new indentation might be wrong.
Perhaps you could use `atomic-change-group' and friends?
Juanma
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Scary undo
2008-05-06 10:04 Scary undo Lennart Borgman (gmail)
2008-05-06 10:11 ` Juanma Barranquero
@ 2008-05-06 10:15 ` David Kastrup
2008-05-06 17:36 ` Lennart Borgman (gmail)
1 sibling, 1 reply; 4+ messages in thread
From: David Kastrup @ 2008-05-06 10:15 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Devel
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> I would like to undo a change made by a function that I call with
> funcall. I do not know exactly what the function does, but hopefully
> it will only indent the current line. However the new indentation
> might be wrong.
>
> The scenario is something like this
>
> (funcall the-indentation-function)
> (when (= 0 (current-indentation))
> ;; undo what `the-indentation-function' did,
> ;; but how?
> )
>
> I am a bit scared of writing this undo part so if someone could help
> me I would be glad. I do not think I can use `undo-boundary' here.
I'd be tempted to do something like
(condition-case nil
(atomic-change-group
(funcall the-indentation-function)
(when (=0 (current-indentation))
(signal 'barfout)))
(barfout))
--
David Kastrup
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Scary undo
2008-05-06 10:15 ` David Kastrup
@ 2008-05-06 17:36 ` Lennart Borgman (gmail)
0 siblings, 0 replies; 4+ messages in thread
From: Lennart Borgman (gmail) @ 2008-05-06 17:36 UTC (permalink / raw)
To: David Kastrup; +Cc: Emacs Devel
David Kastrup wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>
>> I would like to undo a change made by a function that I call with
>> funcall. I do not know exactly what the function does, but hopefully
>> it will only indent the current line. However the new indentation
>> might be wrong.
>>
>> The scenario is something like this
>>
>> (funcall the-indentation-function)
>> (when (= 0 (current-indentation))
>> ;; undo what `the-indentation-function' did,
>> ;; but how?
>> )
>>
>> I am a bit scared of writing this undo part so if someone could help
>> me I would be glad. I do not think I can use `undo-boundary' here.
>
> I'd be tempted to do something like
>
> (condition-case nil
> (atomic-change-group
> (funcall the-indentation-function)
> (when (=0 (current-indentation))
> (signal 'barfout nil)))
> (barfout))
Thanks David and Juanma, that was what I needed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-06 17:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-06 10:04 Scary undo Lennart Borgman (gmail)
2008-05-06 10:11 ` Juanma Barranquero
2008-05-06 10:15 ` David Kastrup
2008-05-06 17:36 ` Lennart Borgman (gmail)
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.