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
|
endif
|
||||||
|
|
||||||
if s:NewInputBuffer('GPGRecipients')
|
if s:NewInputBuffer('GPGRecipients')
|
||||||
" add a autocommand to regenerate the recipients after a write
|
augroup GPGRecipients
|
||||||
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
|
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
|
" put some comments to the scratch buffer
|
||||||
silent put ='GPG: ----------------------------------------------------------------------'
|
silent put ='GPG: ----------------------------------------------------------------------'
|
||||||
@ -767,9 +770,6 @@ function s:GPGFinishRecipientsBuffer()
|
|||||||
execute 'silent! ' . bufwinnr(expand("<afile>:p")) . "wincmd w"
|
execute 'silent! ' . bufwinnr(expand("<afile>:p")) . "wincmd w"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" delete the autocommand
|
|
||||||
autocmd! * <buffer>
|
|
||||||
|
|
||||||
" get the recipients from the scratch buffer
|
" get the recipients from the scratch buffer
|
||||||
let recipients = []
|
let recipients = []
|
||||||
let lines = getline(1,"$")
|
let lines = getline(1,"$")
|
||||||
@ -856,8 +856,11 @@ function gnupg#edit_options()
|
|||||||
|
|
||||||
" only do this if it isn't already a GPGOptions_* buffer
|
" only do this if it isn't already a GPGOptions_* buffer
|
||||||
if s:NewInputBuffer('GPGOptions')
|
if s:NewInputBuffer('GPGOptions')
|
||||||
" add a autocommand to regenerate the options after a write
|
augroup GPGOptions
|
||||||
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
|
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
|
" put some comments to the scratch buffer
|
||||||
silent put ='GPG: ----------------------------------------------------------------------'
|
silent put ='GPG: ----------------------------------------------------------------------'
|
||||||
@ -916,9 +919,6 @@ function s:GPGFinishOptionsBuffer()
|
|||||||
let options = []
|
let options = []
|
||||||
let unknownOptions = []
|
let unknownOptions = []
|
||||||
|
|
||||||
" delete the autocommand
|
|
||||||
autocmd! * <buffer>
|
|
||||||
|
|
||||||
" get the options from the scratch buffer
|
" get the options from the scratch buffer
|
||||||
let lines = getline(1, "$")
|
let lines = getline(1, "$")
|
||||||
for option in lines
|
for option in lines
|
||||||
|
Loading…
Reference in New Issue
Block a user