home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / m / me_cd25.zip / ME2MUTT.ZIP / SAVEALL.MUT < prev    next >
Text File  |  1992-11-09  |  1KB  |  52 lines

  1.   ;; saveall.mut : various ways of saving buffers
  2.  
  3.     ; save-all: save all modified buffers that can be saved
  4.     ; ask-save-and-exit: save modified buffers user wants to save
  5.     ;   and exit.
  6.     ; If the key-pressed-hook is installed, a save-all is done
  7.     ;   every n key presses.
  8.     ; All these ignore buffers that are not attached to files.
  9.     ; C Durland    Public Domain
  10.  
  11. ;;;!!! this is old stuff that needs updating!
  12. (defun
  13.   save-all
  14.   {
  15.     (int j)
  16.     
  17.     (for (j 0) (< j (buffers)) (+= j 1)
  18.       (if (and (buffer-modified j)(!= (file-name j) ""))
  19.       {
  20.     (current-buffer j)(save-buffer)
  21.       })
  22.     )
  23.   }
  24.   ask-save-and-exit
  25.   {
  26.     (int j n)
  27.  
  28.     (n (buffers))(j 0)
  29.     (while (< j n)
  30.     {
  31.       (if (and (buffer-modified j)(!= (file-name j)""))
  32.         (if (yesno "Save "(buffer-name j) " [" (file-name j)"]") ()
  33.     (buffer-modified j FALSE))
  34.       )
  35.       (+= j 1)
  36.     })
  37.     (save-all)
  38.     (exit)
  39.   }
  40. )
  41.  
  42. (const threshold 300)    ; save after this many key presses
  43.  
  44. ;(int keys-pressed)    ; the number of keys pressed since the last save
  45.  
  46. ;(defun
  47. ;  key-pressed-hook
  48. ;  {
  49. ;    (if (> (+= keys-pressed 1) threshold) { (save-all)(keys-pressed 0) } )
  50. ;  }
  51. ;)
  52.