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

Re: undo






=> What is the correct way to obtain the same effect than a (maybe existing?)
=> function {variable}:undo ?
This function doesn't exist in Centaur1.2.

The following function works well for a "simple" modification (change, insert,
delete):

(defun {variable}:undo-modif (variable modifpath)
    (let ((inv-modif (copylist modifpath)))
         (when modifpath
               ({path}:inverse-modif inv-modif)
               (if ({path}:c modifpath)
                   ;; {path}:undo-modif doesn't work when for change to root!
                   ({variable}:change
                       var ({variable}:root var) (#:leaf:new inv-modif))
                   (progn
                      ;; otherwise use {path}:undo-modif
                      ({variable}:update-selections var inv-modif)
                      ({variable}:add-modif var inv-modif)
                      ({path}:undo-modif modifpath ({variable}:root var))
                      ({node-object}:emit var
'{variable}:variable:modified))))))