Re: how to make return follow hyperlink?
[notmuch-archives.git] / 17 / 4344d472c79a4912f7c4bb7f0c5492db0476ca
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 A653C431FBC\r
6         for <notmuch@notmuchmail.org>; Thu,  2 Oct 2014 16:47:30 -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 yMWWguEOmANw for <notmuch@notmuchmail.org>;\r
16         Thu,  2 Oct 2014 16:47:25 -0700 (PDT)\r
17 Received: from cmta18.telus.net (cmta18.telus.net [209.171.16.91])\r
18         by olra.theworths.org (Postfix) with ESMTP id 10CF6431FB6\r
19         for <notmuch@notmuchmail.org>; Thu,  2 Oct 2014 16:47:24 -0700 (PDT)\r
20 Received: from ovo.mains.priv ([207.102.88.62]) by cmta18.telus.net with TELUS\r
21         id yPnP1o0061LiWEf01PnPx4; Thu, 02 Oct 2014 17:47:24 -0600\r
22 X-Authority-Analysis: v=2.0 cv=GdvJa3rL c=1 sm=2\r
23         a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8\r
24         a=lnbEfRDau6mwN6_a2jMA:9 a=uq6gwDkGiqMBWQl4:21 a=EZkrjcdb60U0uwMN: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 v2] VIM: Use notmuch CLI for config\r
30 Date: Thu,  2 Oct 2014 16:47:15 -0700\r
31 Message-Id: <1412293635-31273-1-git-send-email-imain@stemwinder.org>\r
32 X-Mailer: git-send-email 1.9.3\r
33 In-Reply-To: <1412286796-27479-1-git-send-email-imain@stemwinder.org>\r
34 References: <1412286796-27479-1-git-send-email-imain@stemwinder.org>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Thu, 02 Oct 2014 23:47:30 -0000\r
48 \r
49 This patch switches from reading .notmuch-config directly to using\r
50 the CLI the same way that emacs does it.  It actually uses less code\r
51 and is probably less error prone.\r
52 \r
53     Ian\r
54 ---\r
55 \r
56 This update changes result to be '' instead of nil\r
57 by default so missing config items won't cause an error.\r
58 \r
59  vim/notmuch.vim | 31 ++++++++++++-------------------\r
60  1 file changed, 12 insertions(+), 19 deletions(-)\r
61 \r
62 diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
63 index 331e930..b251af6 100644\r
64 --- a/vim/notmuch.vim\r
65 +++ b/vim/notmuch.vim\r
66 @@ -471,28 +471,21 @@ ruby << EOF\r
67         $searches = []\r
68         $threads = []\r
69         $messages = []\r
70 -       $config = {}\r
71         $mail_installed = defined?(Mail)\r
72  \r
73 -       def get_config\r
74 -               group = nil\r
75 -               config = ENV['NOTMUCH_CONFIG'] || '~/.notmuch-config'\r
76 -               File.open(File.expand_path(config)).each do |l|\r
77 -                       l.chomp!\r
78 -                       case l\r
79 -                       when /^\[(.*)\]$/\r
80 -                               group = $1\r
81 -                       when ''\r
82 -                       when /^(.*)=(.*)$/\r
83 -                               key = "%s.%s" % [group, $1]\r
84 -                               value = $2\r
85 -                               $config[key] = value\r
86 -                       end\r
87 -               end\r
88 +       def get_config_item(item)\r
89 +               result = ''\r
90 +               IO.popen(['notmuch', 'config', 'get', item]) { |out|\r
91 +                       result = out.read\r
92 +               }\r
93 +               return result.rstrip\r
94 +       end\r
95  \r
96 -               $db_name = $config['database.path']\r
97 -               $email_name = $config['user.name']\r
98 -               $email_address = $config['user.primary_email']\r
99 +       def get_config\r
100 +               $db_name = get_config_item('database.path')\r
101 +               $email_name = get_config_item('user.name')\r
102 +               $email_address = get_config_item('user.primary_email')\r
103 +               $email_name = get_config_item('user.name')\r
104                 $email = "%s <%s>" % [$email_name, $email_address]\r
105         end\r
106  \r
107 -- \r
108 1.9.3\r
109 \r