Hi,
I've made a write-hook that formats some code. If the code formatter returns an error, I'd like to prevent vile from writing the buffer. So far what I have, but whatever it's doing it doesn't prevent vile from writing the buffer. Am I doing something obviously wrong here? or does vile not support this particular feature?
-mtw
store-procedure gomode-write-action
~if &seq $majormode "go"
goformat
~if $status
set-variable $return FALSE
~return
~endif
~endif
~endm
set write-hook gomode-write-action
store-procedure goformat
~trace on
~local %gobuf
~local %cline
setv %gobuf $cbufname
setv %gofile $cfilname
setv %errbuf "[gofmt errors]"
~if $modified
write-file
~endif
; If we have existing error buffers, delete them.
~hidden ~force delete-buffer %errbuf
~hidden ~force kill-buffer '[Error Expressions]'
~force buffer %errbuf
~hidden edit-file &cat "!gofmt " &cat %gofile " 1> /dev/null"
rename-buffer %errbuf
~if > $blines 0
set error-buffer %errbuf
buffer %gobuf
LoadErrors
set-variable $return FALSE
~else
~hidden ~force unmark-buffer %errbuf
~hidden ~force delete-buffer %errbuf
~local $curcol $curline
goto-beginning-of-file
~quiet filter-til end-of-file "gofmt"
~endif
~endm