From: David P. <da...@ac...> - 2004-04-18 20:13:28
|
I figured out how to make the save macros work to strip trailing whitespace from lines on save: -msnew filt,"sed 's/[ \t]*$//'",rtn,retype -msold filt,"sed 's/[ \t]*$//'",rtn,retype The behavior is interesting, though. When saving a new file for the first time, msnew is run. After that, I would expect that msold would run for future saves. But the file must be re-opened for this to occur. The code for this is in ufile.c:289: if (bw->b->er == -1 && bw->o.msnew) { exemac(bw->o.msnew); bw->b->er = -3; } if (bw->b->er == 0 && bw->o.msold) { exemac(bw->o.msold); } I don't understand the logic of that. buffer.er is documented to be the "Error code when file is loaded". The codes are defined as this: 0 for success -1 for new file (file doesn't exist) -2 for read error -3 for seek error -4 for open error Why is the error code set to "seek error" when a new file is first saved? Shouldn't it be set to "success"? -- David Phillips <da...@ac...> http://david.acz.org/ |