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 >
Text File  |  1995-01-14  |  1KB  |  59 lines

  1.   ;; C Durland    Public Domain
  2.  
  3. (include me.mh)
  4.  
  5. (defun
  6.   turn-on-undo
  7.   {
  8.     (buffer-flags -1 (bit-or (buffer-flags -1) BFUndo))
  9.   }
  10.   iturn-on-undo
  11.   {
  12.     (turn-on-undo)
  13.     (msg "Undo turned on for " (buffer-name -1))
  14.   }
  15.   turn-off-undo
  16.   {
  17.     (buffer-flags -1 (bit-clear (buffer-flags -1) BFUndo))
  18.   }
  19.   iturn-off-undo
  20.   {
  21.     (turn-off-undo)
  22.     (msg "Undo turned off for " (buffer-name -1))
  23.   }
  24.   undo-state ; [(bool turn-on-undo)]
  25.   {
  26.     (if (!= 0 (nargs))
  27.       (if (arg 0) (turn-on-undo) (turn-off-undo)))
  28.  
  29.     (!= 0 (bit-and (buffer-flags -1) BFUndo))
  30.   }
  31. ;  buffer-has-undo (bool turn-on-undo)
  32. ;  {
  33. ;    (if (== (nargs) 1)        ;; got turn-on-undo
  34. ;      (buffer-flags -1
  35. ;    (if turn-on-undo
  36. ;      (bit-or    (buffer-flags -1) BFUndo))
  37. ;      (bit-clear (buffer-flags -1) BFUndo))
  38. ;    (!= 0 (bit-and (buffer-flags -1) BFUndo))
  39. ;  }
  40.   undo
  41.   {
  42.     (switch (do-undo)
  43.       0 
  44.     (cond
  45.       (== 0 (bit-and (buffer-flags -1) BFUndo))
  46.         (msg "Undo is turned off - nothing to undo!")
  47.       (!= 0 (bit-and (buffer-flags -1) BFRead_only))
  48.         (msg "Buffer is read only.")
  49.       TRUE (msg "All undoed - undo list empty."))
  50.       1 (msg "Undoed")
  51.       2 (msg "Undo problems.")
  52.     )
  53.   }
  54.   MAIN
  55.   {
  56.     (register-hook IBUFFER-CREATED-HOOK "turn-on-undo")
  57.   }
  58. )
  59.