From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oOokKIO3fGBZsAAAgWs5BA (envelope-from ) for ; Mon, 19 Apr 2021 00:49:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id GEmtI4O3fGC7XAAAbx9fmQ (envelope-from ) for ; Sun, 18 Apr 2021 22:49:39 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 57D4E1CF86 for ; Mon, 19 Apr 2021 00:49:39 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 63F5A271A9; Sun, 18 Apr 2021 18:49:13 -0400 (EDT) Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by mail.notmuchmail.org (Postfix) with ESMTPS id E77EE27196 for ; Sun, 18 Apr 2021 18:49:08 -0400 (EDT) Received: by mail-ot1-x331.google.com with SMTP id a2-20020a0568300082b029028d8118b91fso12425372oto.2 for ; Sun, 18 Apr 2021 15:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q6tvJ1hbz6WDo2Iw3I1ZEaGQrj+CK8haK85d6vIkgq8=; b=u71cDcl9ExV0HiUdar01EWPcykTN4dmFdo0XImwVFh5HQ2JgWJg7iqpvO8XmLfC2BN X4lxvGFCTuOqMqZ5ujACJvF8mn6CC8E8fuYn16XWENQrmmQW74d45z9J6TL5iJlozxVF 71G8zeHQAMybNjDHfRDAdIZp0R+I9KKV0oJGTPqFkyMa9NRxLDJeQb2SFRenwpzV4DQl Ru6p3mlm0HG/Ia/fTJCum/lNX2Lmtf96GwwPAnVuDV4bQOj1r+ZYf8ofbVRywjhb2Gsi 8atNut3S/1cqaAvR2AzJJ9vfc9iCj5qFGveX4SRtW0jjQsCMbsgAsLXvgRHCcLsSxzx4 l4sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q6tvJ1hbz6WDo2Iw3I1ZEaGQrj+CK8haK85d6vIkgq8=; b=SKzvRWGPFOfAE4hh8ZrLLbhpYbnOP+Y7Di7Caka+VbYGYMpdZVfcZyPF72FslejLdm h+JnAhfdE+TX3cM403JKNET1W7HHeS1ygM2LNF2C+cj8buDWMOgkpB80V3kItvEC+D+F js7Bu3kFVn3FTxj1HhMKeZB/y3SzczVcDHM3xVPOs4pUadnAxjwQJROljDvcejezcOJ5 tSQmqUY8Y3B1DpZOkCXrjCpKGLcQIfLQorfPmC7GU0X0k35Y+K6aao758qKBE/jsH4n5 Npqn7yn/FAuJsVkMtyiwckY3OuUlv6no3kGFMPg7wBs8A+y3X4WDpPQDWNEH12ByoMSR Hp0w== X-Gm-Message-State: AOAM530BUm6Evjo6dxEK33bl/qNe+cXI/5akOu0A29DMG230d52R+BQ7 MUYZEvQnz1VduRIGxR5oydRxb9Zkrgt4aw== X-Google-Smtp-Source: ABdhPJw/0fSx26kn18ZmBNWOQfwXkE1hof+L86JcO/8MSPtuHHFSjzLISNKhx6g9h7Zte65utnWmyw== X-Received: by 2002:a9d:6b19:: with SMTP id g25mr12564705otp.102.1618786147568; Sun, 18 Apr 2021 15:49:07 -0700 (PDT) Received: from localhost ([2806:2f0:4000:bfd0:a2c5:89ff:fe0c:1151]) by smtp.gmail.com with ESMTPSA id p64sm2861516oib.57.2021.04.18.15.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Apr 2021 15:49:07 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Cc: Felipe Contreras Subject: [PATCH 07/13] vim: use notmuch config command Date: Sun, 18 Apr 2021 17:48:45 -0500 Message-Id: <20210418224851.88240-8-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210418224851.88240-1-felipe.contreras@gmail.com> References: <20210418224851.88240-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Message-ID-Hash: DLU4NGF7J2TUDLMUA45FHSIF4CQWMV7G X-Message-ID-Hash: DLU4NGF7J2TUDLMUA45FHSIF4CQWMV7G X-MailFrom: felipe.contreras@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618786179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=NO2PJeKUKXeISI/kSs3QyZ2gaBlifpb/l1yS/D/VzBo=; b=k7RDO8b+v/BsxR5X5pZa53FJncT26Ce9MOJMFeiy0z9F6PE31BKUhcpx+aQZ4bir7f9scM S7N7GGdMIIFqD1ajfp1Vg9Bj9JbZ//qx76td76rXl9cBBt9dPrNI1UdMOeYLF5cnGGm44N ERH8ZKgFQMWp7SH0gTuReBNd5U9bT7lt6vmXRwsxo6am+fCqhoyctBZF9dnbs84pofOb/3 ZAup7AHaXRqukeq/2dnehxBNlfnC0SdHug8j9Ifw9HqoGNA3SSWtyOmfPDz/Xws2zm08Xg hppKQlu/5O9G52w6nR0731qN+CEbK/cz/BLsY8A+jU7sb71PIu+NG6aQgVt0kA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618786179; a=rsa-sha256; cv=none; b=khWhsI098lqRSXx88ozWKyZsteRifQZo/t4ZLEmPHuV7SxQ5f0xF3iIV98vZI/6C/+X15q niIyDfp5XOGsPZ5AWoVVUkdnuwJA5uHra0iasS0ZKuWpUG3DQq5SVqJW3HSsnjcnO4bzaE MLJOpcsXR3BAZo2Kq1e94or/jn67Eb1lEw1wRqaiHIMp3XCFWDdrScn98PeV3jo8MsMEo5 GrKgGwEA6lCQBwNYUpbsZ0wJvpBBvBoZ9F0qwNf4uVsycV6KOTJbQyRZG38yPZ0bfpl76l peUmWvJhZW6kW72u/zzBRpv/pjSv1a55CBr+HXC3rOKsLjqF525d4ULAlfzASg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=u71cDcl9; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.89 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=u71cDcl9; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 57D4E1CF86 X-Spam-Score: -0.89 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2k0Kvl+aBKv9 This simplifies the configuration parsing, is more efficient, and also reverts back to previous logic. Signed-off-by: Felipe Contreras --- 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