[comp.emacs] MicroEMACS 3.10 backup macro for Unix

chet@uwovax.uwo.ca (01/18/90)

I've found the following macro to be a nice security blanket--
Chet Creider (creider@csd.uwo.ca)

; file: .emacsrc -- MicroEMACS startup file for Unix version

;for single-line scrolling uncomment next line
;set $sscroll TRUE

bind-to-key meta-prefix `
write-message "meta key is grave accent"

; the following macro creates a backup file with extension .BAK
; whenever a buffer is saved with ^x^s -- CAC

22	store-macro
	set %dotpos &sin $cfname "."
	!if &equ %dotpos 0
		set %cflen &len $cfname
		set %dotpos &add %cflen 1
	!endif
	set %dotpos &sub %dotpos 1
	set %backup &mid $cfname 1 %dotpos
	set %backup &cat %backup ".BAK"
	set %oldfile &cat $cfname " "
	set %backup &cat %oldfile %backup
	shell-command &cat "cp "  %backup
	save-file
	!endm

bind-to-key execute-macro-22 ^X^S

set $gmode 3