[PATCH 4/4] Update NEWS for user.other_name
[notmuch-archives.git] / 2e / 79bcbd3e148a74c97710d7bbc570ead5b268f5
1 Return-Path: <imain@stemwinder.org>\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 46496431FBC\r
6         for <notmuch@notmuchmail.org>; Thu,  2 Oct 2014 14:53:25 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 6Ua3J8oc4B9E for <notmuch@notmuchmail.org>;\r
16         Thu,  2 Oct 2014 14:53:19 -0700 (PDT)\r
17 Received: from cmta3.telus.net (cmta3.telus.net [209.171.16.76])\r
18         by olra.theworths.org (Postfix) with ESMTP id 8A207431FB6\r
19         for <notmuch@notmuchmail.org>; Thu,  2 Oct 2014 14:53:19 -0700 (PDT)\r
20 Received: from ovo.mains.priv ([207.102.88.62]) by cmta3.telus.net with TELUS\r
21         id yMtJ1o00Y1LiWEf01MtJqG; Thu, 02 Oct 2014 15:53:19 -0600\r
22 X-Authority-Analysis: v=2.0 cv=GePJa3rL c=1 sm=2\r
23         a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8\r
24         a=lnbEfRDau6mwN6_a2jMA:9 a=982h0VeBkKRggbAd:21 a=CmYvmRXf5uR-RLfk:21\r
25         a=EcQDfIwDZEqJA1f7rVUV8Q==:117\r
26 X-Telus-Outbound-IP: 207.102.88.62\r
27 From: Ian Main <imain@stemwinder.org>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH] VIM: Use notmuch CLI for config\r
30 Date: Thu,  2 Oct 2014 14:53:16 -0700\r
31 Message-Id: <1412286796-27479-1-git-send-email-imain@stemwinder.org>\r
32 X-Mailer: git-send-email 1.9.3\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.13\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Thu, 02 Oct 2014 21:53:25 -0000\r
46 \r
47 This patch switches from reading .notmuch-config directly to using\r
48 the CLI the same way that emacs does it.  It actually uses less code\r
49 and is probably less error prone.\r
50 \r
51     Ian\r
52 ---\r
53  vim/notmuch.vim | 31 ++++++++++++-------------------\r
54  1 file changed, 12 insertions(+), 19 deletions(-)\r
55 \r
56 diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
57 index 331e930..faee3d2 100644\r
58 --- a/vim/notmuch.vim\r
59 +++ b/vim/notmuch.vim\r
60 @@ -471,28 +471,21 @@ ruby << EOF\r
61         $searches = []\r
62         $threads = []\r
63         $messages = []\r
64 -       $config = {}\r
65         $mail_installed = defined?(Mail)\r
66  \r
67 -       def get_config\r
68 -               group = nil\r
69 -               config = ENV['NOTMUCH_CONFIG'] || '~/.notmuch-config'\r
70 -               File.open(File.expand_path(config)).each do |l|\r
71 -                       l.chomp!\r
72 -                       case l\r
73 -                       when /^\[(.*)\]$/\r
74 -                               group = $1\r
75 -                       when ''\r
76 -                       when /^(.*)=(.*)$/\r
77 -                               key = "%s.%s" % [group, $1]\r
78 -                               value = $2\r
79 -                               $config[key] = value\r
80 -                       end\r
81 -               end\r
82 +       def get_config_item(item)\r
83 +               result = nil\r
84 +               IO.popen(['notmuch', 'config', 'get', item]) { |out|\r
85 +                       result = out.read\r
86 +               }\r
87 +               return result.rstrip\r
88 +       end\r
89  \r
90 -               $db_name = $config['database.path']\r
91 -               $email_name = $config['user.name']\r
92 -               $email_address = $config['user.primary_email']\r
93 +       def get_config\r
94 +               $db_name = get_config_item('database.path')\r
95 +               $email_name = get_config_item('user.name')\r
96 +               $email_address = get_config_item('user.primary_email')\r
97 +               $email_name = get_config_item('user.name')\r
98                 $email = "%s <%s>" % [$email_name, $email_address]\r
99         end\r
100  \r
101 -- \r
102 1.9.3\r
103 \r