This simplifies the configuration parsing, is more efficient, and also reverts back to previous logic.
Signed-off-by: Felipe Contreras <felipe.contre...@gmail.com> --- vim/notmuch.vim | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/vim/notmuch.vim b/vim/notmuch.vim index 97167461..8777d412 100644 --- a/vim/notmuch.vim +++ b/vim/notmuch.vim @@ -484,24 +484,22 @@ ruby << EOF $searches = [] $threads = [] $messages = [] + $config = {} $mail_installed = defined?(Mail) - def get_config_item(item) - result = '' - IO.popen(['notmuch', 'config', 'get', item]) { |out| - result = out.read - } - return result.rstrip - end - def get_config - $db_name = get_config_item('database.path') - $email_name = get_config_item('user.name') - $email_address = get_config_item('user.primary_email') - $email_name = get_config_item('user.name') + IO.popen(%w[notmuch config list]) do |io| + io.each(chomp: true) do |e| + key, value = e.split('=') + $config[key] = value + end + end + + $db_name = $config['database.path'] + $email_name = $config['user.name'] + $email_address = $config['user.primary_email'] + $exclude_tags = $config['search.exclude_tags']&.split(';') || [] $email = "%s <%s>" % [$email_name, $email_address] - ignore_tags = get_config_item('search.exclude_tags') - $exclude_tags = ignore_tags.split("\n") end def vim_puts(s) -- 2.31.0 _______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org