Aotocommand rework
Make GPGFinish*() more robust, change to window if closed from another. Also install autocmd in GPGEdit*() if we split an existing buffer.
This commit is contained in:
parent
621813ef6e
commit
60b7fb1ede
@ -392,6 +392,9 @@ fun s:GPGEditRecipients()
|
|||||||
else
|
else
|
||||||
" split scratch buffer window
|
" split scratch buffer window
|
||||||
exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
|
exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
|
||||||
|
|
||||||
|
" add a autocommand to regenerate the recipients after a write
|
||||||
|
autocmd BufHidden,BufUnload <buffer> call s:GPGFinishRecipientsBuffer()
|
||||||
endi
|
endi
|
||||||
|
|
||||||
" empty the buffer
|
" empty the buffer
|
||||||
@ -478,12 +481,19 @@ fun s:GPGFinishRecipientsBuffer()
|
|||||||
return
|
return
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
" go to buffer before doing work
|
||||||
|
if (bufnr("%") != expand("<abuf>"))
|
||||||
|
" switch to scratch buffer window
|
||||||
|
exe 'silent! ' . bufwinnr(expand("<afile>")) . "wincmd w"
|
||||||
|
endi
|
||||||
|
|
||||||
" clear GPGRecipients and GPGUnknownRecipients
|
" clear GPGRecipients and GPGUnknownRecipients
|
||||||
let GPGRecipients=""
|
let GPGRecipients=""
|
||||||
let GPGUnknownRecipients=""
|
let GPGUnknownRecipients=""
|
||||||
|
|
||||||
" delete the autocommand
|
" delete the autocommand
|
||||||
autocmd! * <buffer>
|
autocmd! * <buffer>
|
||||||
|
|
||||||
let currentline=1
|
let currentline=1
|
||||||
let recipient=getline(currentline)
|
let recipient=getline(currentline)
|
||||||
|
|
||||||
@ -588,6 +598,9 @@ fun s:GPGEditOptions()
|
|||||||
else
|
else
|
||||||
" split scratch buffer window
|
" split scratch buffer window
|
||||||
exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
|
exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
|
||||||
|
|
||||||
|
" add a autocommand to regenerate the options after a write
|
||||||
|
autocmd BufHidden,BufUnload <buffer> call s:GPGFinishOptionsBuffer()
|
||||||
endi
|
endi
|
||||||
|
|
||||||
" empty the buffer
|
" empty the buffer
|
||||||
@ -654,12 +667,19 @@ fun s:GPGFinishOptionsBuffer()
|
|||||||
return
|
return
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
" go to buffer before doing work
|
||||||
|
if (bufnr("%") != expand("<abuf>"))
|
||||||
|
" switch to scratch buffer window
|
||||||
|
exe 'silent! ' . bufwinnr(expand("<afile>")) . "wincmd w"
|
||||||
|
endi
|
||||||
|
|
||||||
" clear GPGOptions and GPGUnknownOptions
|
" clear GPGOptions and GPGUnknownOptions
|
||||||
let GPGOptions=""
|
let GPGOptions=""
|
||||||
let GPGUnknownOptions=""
|
let GPGUnknownOptions=""
|
||||||
|
|
||||||
" delete the autocommand
|
" delete the autocommand
|
||||||
autocmd! * <buffer>
|
autocmd! * <buffer>
|
||||||
|
|
||||||
let currentline=1
|
let currentline=1
|
||||||
let option=getline(currentline)
|
let option=getline(currentline)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user