home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
editor
/
me_cd.arc
/
SAVEALL.MUT
< prev
next >
Wrap
Text File
|
1988-04-04
|
1KB
|
55 lines
;; saveall.mut : various ways of saving buffers
; save-all: save all modified buffers that can be saved
; ask-save-and-exit: save modified buffers user wants to save
; and exit.
; If the key-pressed-hook is installed, a save-all is done
; every n key presses.
; All these ignore buffers that are not attached to files.
; C Durland
(include spoint.mut)
(defun
save-all
{
(int j)
(for (j 0) (< j (buffers)) (+= j 1)
(if (and (buffer-modified j)(!= (file-name j) ""))
{
(save-point)
(switch-to-buffer (buffer-name j))(save-buffer)
(restore-point)
})
)
}
ask-save-and-exit
{
(int j n)
(n (buffers))(j 0)
(while (< j n)
{
(if (and (buffer-modified j)(!= (file-name j)""))
(if (yesno "Save "(buffer-name j) " [" (file-name j)"]") ()
(buffer-modified j FALSE))
)
(+= j 1)
})
(save-all)
(exit)
}
)
(const threshold 300) ; save after this many key presses
(int keys-pressed) ; the number of keys pressed since the last save
(defun
key-pressed-hook
{
(if (> (+= keys-pressed 1) threshold) { (save-all)(keys-pressed 0) } )
}
)