leahneukirchen / mblaze

Unix utilities to deal with Maildir
Other
444 stars 48 forks source link

mcom does not delete file when quitting $EDITOR with RC !=0 #145

Closed Anachron closed 5 years ago

Anachron commented 5 years ago

When I open a new message up via mcom and quit my editor (vim) using :cq, causing it to return 1 as RC it will not delete the snd.0 file even though it tells me it did cancel: mcom: cancelled draft ./snd.0.

I think since we don't want to delete files that were previously there it would be good to check if the file has been there before or is created (store a flag somewhere in the code) and if its created but cancelled remove it.

leahneukirchen commented 5 years ago

Cancelling means you abort editing the mail, but I agree that :cq is more like deleting (which asks for safety again). I thus made non-0 exit status perform like delete.