Subject: example vile macro to ispell Usenet Posting or e-mail msg

From: [email-masked] (Clark O. Morgan)
Date: Wed, 22 Jan 1997 05:02:48 -0800

This might be a useful example for vile users learning the vile 
macro syntax....

================= Cut here ============================

; Vile macro to ispell an e-mail msg or USENET posting that contains
; msg headers (headers are separated from body by at least one blank line).
; This macro feeds the Subject: header and msg body to ispell, then glues
; the returned result back into the original message.  NB: this macro does
; not handle a Subject: hdr that's continued over more than one line and
; it assumes that the blank line separating hdrs & body is exactly "^$" .
23 store-macro
    beginning-of-file
    search-forward "^"  ; $match has known value
    load-register p ""
    ~force search-forward "^Subject:"
    ~if &seq "Subject:" $match
        use-register p delete-til lines      ; delete til eol
    ~endif
    beginning-of-file
    ~force search-forward "^$"
    ~if &seq "" $match
        use-register P delete-til goto-line  ; delete til EOF
    ~else            ; Assume no msg body, add blank line as msg
        end-of-file
        1 force-blank-lines
        use-register P delete-til goto-line  ; delete til EOF
    ~endif
    write-file
    set-variable %origfile $cfilname
    set-variable %tmpleaf &cat ".vile.ispell." $pid
    set-variable %tmpfile &cat "$HOME/" %tmpleaf
    edit-file %tmpfile
    use-register p put-after ; put subj hdr & msg body in tmp file
    write-file
    1 shell-command &cat "chmod go-rwx " %tmpfile  ; protect file contents
    1 shell-command &cat "ispell " $cfilname
    edit-file %origfile
    end-of-file
    insert-file %tmpfile
    delete-buffer %tmpleaf
    1 shell-command &cat &cat "rm " %tmpfile "*"   ; cleanup tmpfile
~endm
bind-key execute-macro-23 #-i   ; invoke with the keystroke #i

This might be a useful example for vile users learning the vile 
macro syntax....

================= Cut here ============================

; Vile macro to ispell an e-mail msg or USENET posting that contains
; msg headers (headers are separated from body by at least one blank line).
; This macro feeds the Subject: header and msg body to ispell, then glues
; the returned result back into the original message.  NB: this macro does
; not handle a Subject: hdr that's continued over more than one line and
; it assumes that the blank line separating hdrs & body is exactly "^$" .
23 store-macro
    beginning-of-file
    search-forward "^"  ; $match has known value
    load-register p ""
    ~force search-forward "^Subject:"
    ~if &seq "Subject:" $match
        use-register p delete-til lines      ; delete til eol
    ~endif
    beginning-of-file
    ~force search-forward "^$"
    ~if &seq "" $match
        use-register P delete-til goto-line  ; delete til EOF
    ~else            ; Assume no msg body, add blank line as msg
        end-of-file
        1 force-blank-lines
        use-register P delete-til goto-line  ; delete til EOF
    ~endif
    write-file
    set-variable %origfile $cfilname
    set-variable %tmpleaf &cat ".vile.ispell." $pid
    set-variable %tmpfile &cat "$HOME/" %tmpleaf
    edit-file %tmpfile
    use-register p put-after ; put subj hdr & msg body in tmp file
    write-file
    1 shell-command &cat "chmod go-rwx " %tmpfile  ; protect file contents
    1 shell-command &cat "ispell " $cfilname
    edit-file %origfile
    end-of-file
    insert-file %tmpfile
    delete-buffer %tmpleaf
    1 shell-command &cat &cat "rm " %tmpfile "*"   ; cleanup tmpfile
~endm
bind-key execute-macro-23 #-i   ; invoke with the keystroke #i