home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
me34src.zip
/
me3
/
mutt
/
builtin
/
undo.mut
< prev
next >
Wrap
Text File
|
1995-01-14
|
1KB
|
59 lines
;; C Durland Public Domain
(include me.mh)
(defun
turn-on-undo
{
(buffer-flags -1 (bit-or (buffer-flags -1) BFUndo))
}
iturn-on-undo
{
(turn-on-undo)
(msg "Undo turned on for " (buffer-name -1))
}
turn-off-undo
{
(buffer-flags -1 (bit-clear (buffer-flags -1) BFUndo))
}
iturn-off-undo
{
(turn-off-undo)
(msg "Undo turned off for " (buffer-name -1))
}
undo-state ; [(bool turn-on-undo)]
{
(if (!= 0 (nargs))
(if (arg 0) (turn-on-undo) (turn-off-undo)))
(!= 0 (bit-and (buffer-flags -1) BFUndo))
}
; buffer-has-undo (bool turn-on-undo)
; {
; (if (== (nargs) 1) ;; got turn-on-undo
; (buffer-flags -1
; (if turn-on-undo
; (bit-or (buffer-flags -1) BFUndo))
; (bit-clear (buffer-flags -1) BFUndo))
; (!= 0 (bit-and (buffer-flags -1) BFUndo))
; }
undo
{
(switch (do-undo)
0
(cond
(== 0 (bit-and (buffer-flags -1) BFUndo))
(msg "Undo is turned off - nothing to undo!")
(!= 0 (bit-and (buffer-flags -1) BFRead_only))
(msg "Buffer is read only.")
TRUE (msg "All undoed - undo list empty."))
1 (msg "Undoed")
2 (msg "Undo problems.")
)
}
MAIN
{
(register-hook IBUFFER-CREATED-HOOK "turn-on-undo")
}
)