vim: Get user email address from notmuch config file.

Here's a bitty patch to the vim plugin; it now calculates the primary email
of the user based on a call to notmuch config.  There's still a lot of work
that needs to get done on notmuch.vim, e.g., the ability to have multiple
emails/accounts.
This commit is contained in:
Peter John Hartman 2011-01-26 16:57:12 +10:00 committed by Carl Worth
parent db70f3f0c4
commit 4aeb291c78

View file

@ -18,7 +18,8 @@
" along with Notmuch. If not, see <http://www.gnu.org/licenses/>. " along with Notmuch. If not, see <http://www.gnu.org/licenses/>.
" "
" Authors: Bart Trojanowski <bart@jukie.net> " Authors: Bart Trojanowski <bart@jukie.net>
" Contributors: Peter Hartman <peterjohnhartman@gmail.com>
"
" --- configuration defaults {{{1 " --- configuration defaults {{{1
let s:notmuch_defaults = { let s:notmuch_defaults = {
@ -1024,11 +1025,9 @@ endfunction
" --- --- compose screen helper functions {{{2 " --- --- compose screen helper functions {{{2
function! s:NM_compose_get_user_email() function! s:NM_compose_get_user_email()
let name = substitute(system('id -u -n'), '\v(^\s*|\s*$|\n)', '', 'g') " TODO: do this properly (still), i.e., allow for multiple email accounts
let fqdn = substitute(system('hostname -f'), '\v(^\s*|\s*$|\n)', '', 'g') let email = substitute(system('notmuch config get user.primary_email'), '\v(^\s*|\s*$|\n)', '', 'g')
return email
" TODO: do this properly
return name . '@' . fqdn
endfunction endfunction
function! s:NM_compose_find_line_match(start, pattern, failure) function! s:NM_compose_find_line_match(start, pattern, failure)