emacs-devel
[Top][All Lists]
Advanced

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

Re: Scary undo


From: Lennart Borgman (gmail)
Subject: Re: Scary undo
Date: Tue, 06 May 2008 19:36:42 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

David Kastrup wrote:
"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 nil)))
  (barfout))

Thanks David and Juanma, that was what I needed.




reply via email to

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