Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / ab / 206bf626179e6f20a94334797f453e3e9512a2
1 Return-Path: <alpine.art.de@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 11D31431FBD\r
6         for <notmuch@notmuchmail.org>; Fri, 10 Oct 2014 02:32:09 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id FdVJyeiI-Cnh for <notmuch@notmuchmail.org>;\r
17         Fri, 10 Oct 2014 02:32:01 -0700 (PDT)\r
18 Received: from mail-la0-f52.google.com (mail-la0-f52.google.com\r
19         [209.85.215.52]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 62823431FBC\r
22         for <notmuch@notmuchmail.org>; Fri, 10 Oct 2014 02:32:01 -0700 (PDT)\r
23 Received: by mail-la0-f52.google.com with SMTP id hz20so2804070lab.25\r
24         for <notmuch@notmuchmail.org>; Fri, 10 Oct 2014 02:31:54 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=date:message-id:from:to:subject:in-reply-to:references:mime-version\r
27         :content-type:content-disposition:content-transfer-encoding;\r
28         bh=5Dlity+fPMEVPz7hZQjE+0/hQHuVBNK+rvO5r6SPMzM=;\r
29         b=GMlKs+JqSVPogpf3Ft4Ck6d3slgmSYBAQVfoEO5RI9DRwCjkjy2jngJO5HF5y22ALu\r
30         CECBg52jFyiVcM6QzChRdn+r6WDMeVDRQKENXougbsXHpCNzk9F6h9tPmlqjgfvTp0Gm\r
31         01cGGF7K7jCI67QJ2LCYBfJdnV2BnxW+SVPjkxwAVwZ6z5IDYqGx0p/mBoQ9cWDGVweU\r
32         qlomV328vK4F9wUp8RiKz/Q/b6l1DvJ8tVtyqH1tagePPSShHMsy0LNsa6LKICvZEyhO\r
33         OST91DVKZBF9q3cOgoPVAFOih3dliFSFrpG2c0h2nGG03voslI1+Sb9bAXhRdZNMK5tY\r
34         EofA==\r
35 X-Received: by 10.112.134.229 with SMTP id pn5mr3355576lbb.22.1412933514470;\r
36         Fri, 10 Oct 2014 02:31:54 -0700 (PDT)\r
37 Received: from localhost (p5B00C9E6.dip0.t-ipconnect.de. [91.0.201.230])\r
38         by mx.google.com with ESMTPSA id z1sm867808lad.40.2014.10.10.02.31.52\r
39         for <notmuch@notmuchmail.org>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Fri, 10 Oct 2014 02:31:53 -0700 (PDT)\r
42 Date: Fri, 10 Oct 2014 11:32:02 +0200\r
43 Message-ID: <20141010113202.GE28601@TP_L520.localdomain>\r
44 From: Franz Fellner <alpine.art.de@gmail.com>\r
45 To: notmuch@notmuchmail.org\r
46 Subject: Re: [PATCH v2] VIM: Use notmuch CLI for config\r
47 In-Reply-To: <1412293635-31273-1-git-send-email-imain@stemwinder.org>\r
48 References: <1412286796-27479-1-git-send-email-imain@stemwinder.org>\r
49         <1412293635-31273-1-git-send-email-imain@stemwinder.org>\r
50 MIME-Version: 1.0\r
51 Content-Type: text/plain; charset=utf-8\r
52 Content-Disposition: inline\r
53 Content-Transfer-Encoding: 8bit\r
54 X-BeenThere: notmuch@notmuchmail.org\r
55 X-Mailman-Version: 2.1.13\r
56 Precedence: list\r
57 List-Id: "Use and development of the notmuch mail system."\r
58         <notmuch.notmuchmail.org>\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
62 List-Post: <mailto:notmuch@notmuchmail.org>\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
66 X-List-Received-Date: Fri, 10 Oct 2014 09:32:09 -0000\r
67 \r
68 On Thu,  2 Oct 2014 16:47:15 -0700, Ian Main <imain@stemwinder.org> wrote:\r
69 > This patch switches from reading .notmuch-config directly to using\r
70 > the CLI the same way that emacs does it.  It actually uses less code\r
71 > and is probably less error prone.\r
72\r
73 >     Ian\r
74 > ---\r
75\r
76 > This update changes result to be '' instead of nil\r
77 > by default so missing config items won't cause an error.\r
78\r
79 >  vim/notmuch.vim | 31 ++++++++++++-------------------\r
80 >  1 file changed, 12 insertions(+), 19 deletions(-)\r
81\r
82 > diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
83 > index 331e930..b251af6 100644\r
84 > --- a/vim/notmuch.vim\r
85 > +++ b/vim/notmuch.vim\r
86 > @@ -471,28 +471,21 @@ ruby << EOF\r
87 >       $searches = []\r
88 >       $threads = []\r
89 >       $messages = []\r
90 > -     $config = {}\r
91 >       $mail_installed = defined?(Mail)\r
92 >  \r
93 > -     def get_config\r
94 > -             group = nil\r
95 > -             config = ENV['NOTMUCH_CONFIG'] || '~/.notmuch-config'\r
96 > -             File.open(File.expand_path(config)).each do |l|\r
97 > -                     l.chomp!\r
98 > -                     case l\r
99 > -                     when /^\[(.*)\]$/\r
100 > -                             group = $1\r
101 > -                     when ''\r
102 > -                     when /^(.*)=(.*)$/\r
103 > -                             key = "%s.%s" % [group, $1]\r
104 > -                             value = $2\r
105 > -                             $config[key] = value\r
106 > -                     end\r
107 > -             end\r
108 > +     def get_config_item(item)\r
109 > +             result = ''\r
110 > +             IO.popen(['notmuch', 'config', 'get', item]) { |out|\r
111 > +                     result = out.read\r
112 > +             }\r
113 > +             return result.rstrip\r
114 > +     end\r
115 >  \r
116 > -             $db_name = $config['database.path']\r
117 > -             $email_name = $config['user.name']\r
118 > -             $email_address = $config['user.primary_email']\r
119 > +     def get_config\r
120 > +             $db_name = get_config_item('database.path')\r
121 > +             $email_name = get_config_item('user.name')\r
122 > +             $email_address = get_config_item('user.primary_email')\r
123 > +             $email_name = get_config_item('user.name')\r
124 \r
125 Just wanted to note that you read user.name twice.\r
126 \r
127 >               $email = "%s <%s>" % [$email_name, $email_address]\r
128 This is not related to this patch:\r
129 I don't know if it is a good idea to force $email_name on every\r
130 $email_address. Maybe use it as a fallback and introduce an optional\r
131 mailaddress-sendername map. So the user can specify which name should be\r
132 used. (Imagine a "Dr." who wants to have "Dr. P. Harmony" for his official\r
133 mails, but "Phil Harmony" for private ones. Or a writer who uses several\r
134 psudonyms.)\r
135 Maybe this can be solved by the sendmail application, but probably\r
136 that requires leaving out email_name entirely. Will setup a test env\r
137 later to evaluate.\r
138 \r
139 >       end\r
140 >  \r
141 > -- \r
142 > 1.9.3\r
143\r
144 > _______________________________________________\r
145 > notmuch mailing list\r
146 > notmuch@notmuchmail.org\r
147 > http://notmuchmail.org/mailman/listinfo/notmuch\r