Define GPGEdit{Options,Recipients} autocmd in their own group
This allows them to be properly cleared only when the buffer is re-created/loaded. This fixes the handling of the autocmds when the Edit buffer is saved, but not hidden or deleted. The autocmd remains in place, rather than having an acwrite buffer with no autocmd set. Signed-off-by: James McCoy <jamessan@jamessan.com>
This commit is contained in:
parent
d90ae08795
commit
32360c8f20
@ -680,8 +680,11 @@ function gnupg#edit_recipients()
|
||||
endif
|
||||
|
||||
if s:NewInputBuffer('GPGRecipients')
|
||||
augroup GPGRecipients
|
||||
au! * <buffer>
|
||||
" add a autocommand to regenerate the recipients after a write
|
||||
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
|
||||
augroup END
|
||||
|
||||
" put some comments to the scratch buffer
|
||||
silent put ='GPG: ----------------------------------------------------------------------'
|
||||
@ -767,9 +770,6 @@ function s:GPGFinishRecipientsBuffer()
|
||||
execute 'silent! ' . bufwinnr(expand("<afile>:p")) . "wincmd w"
|
||||
endif
|
||||
|
||||
" delete the autocommand
|
||||
autocmd! * <buffer>
|
||||
|
||||
" get the recipients from the scratch buffer
|
||||
let recipients = []
|
||||
let lines = getline(1,"$")
|
||||
@ -856,8 +856,11 @@ function gnupg#edit_options()
|
||||
|
||||
" only do this if it isn't already a GPGOptions_* buffer
|
||||
if s:NewInputBuffer('GPGOptions')
|
||||
augroup GPGOptions
|
||||
au! * <buffer>
|
||||
" add a autocommand to regenerate the options after a write
|
||||
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
|
||||
augroup END
|
||||
|
||||
" put some comments to the scratch buffer
|
||||
silent put ='GPG: ----------------------------------------------------------------------'
|
||||
@ -916,9 +919,6 @@ function s:GPGFinishOptionsBuffer()
|
||||
let options = []
|
||||
let unknownOptions = []
|
||||
|
||||
" delete the autocommand
|
||||
autocmd! * <buffer>
|
||||
|
||||
" get the options from the scratch buffer
|
||||
let lines = getline(1, "$")
|
||||
for option in lines
|
||||
|
Loading…
Reference in New Issue
Block a user