emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scary undo


From: David Kastrup
Subject: Re: Scary undo
Date: Tue, 06 May 2008 12:15:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

"Lennart Borgman (gmail)" <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]