Skip to content

Commit

Permalink
Clear GPGOptions/GPGRecipients autocommands on BufUnload
Browse files Browse the repository at this point in the history
The BufHidden autocommand will have already called the respective Finish
function.  Clearing the autocommands during BufUnload ensures they don't
inadvertently run when Vim is shutting down.

Closes #104
  • Loading branch information
jamessan committed Nov 11, 2020
1 parent a72ab0b commit 38fe47b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions autoload/gnupg.vim
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,8 @@ function gnupg#edit_recipients()
augroup GPGRecipients
au! * <buffer>
" add a autocommand to regenerate the recipients after a write
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
autocmd BufHidden,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
autocmd BufUnload <buffer> exe 'au! GPGRecipients * <buffer='. expand('<abuf>') .'>'
augroup END

" put some comments to the scratch buffer
Expand Down Expand Up @@ -861,7 +862,8 @@ function gnupg#edit_options()
augroup GPGOptions
au! * <buffer>
" add a autocommand to regenerate the options after a write
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
autocmd BufHidden,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
autocmd BufUnload <buffer> exe 'au! GPGOptions * <buffer='. expand('<abuf>') .'>'
augroup END

" put some comments to the scratch buffer
Expand Down

0 comments on commit 38fe47b

Please sign in to comment.