I've got a situation similar to the following:

augroup A
   autocmd BufWritePre  <buffer> [stuff that changes the buffer before writing]
augroup END

augroup B
   autocmd BufWritePre  <buffer> [stuff that changes the buffer before writing]
   autocmd BufWritePost <buffer> undo
augroup END


Obviously, in group A I'm trying to make a change in the buffer as well as on 
disk.  In group B, I'm trying to only make a change to disk.

The command handlers are invoked in the order seen.  First Pre A, then Pre B, 
then Post B.

The problem is that the post command in group B is undoing the changes from 
group A, as well from itself.  The problem is that it isn't easy to reverse the 
modifications in Pre B, other than by invoking :undo.


Any ideas?

Reply via email to