[PATCH 4/4] Update NEWS for user.other_name
[notmuch-archives.git] / 36 / 81a1b1db75e85396e58cb0c0cf948595569417
1 Return-Path: <amdragon@mit.edu>\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 7DF61431FDA\r
6         for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 12:04:37 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 P-r50hoNwUEE for <notmuch@notmuchmail.org>;\r
16         Sat, 15 Dec 2012 12:04:36 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
18         [18.9.25.14])\r
19         by olra.theworths.org (Postfix) with ESMTP id 3E69E431FBF\r
20         for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 12:04:35 -0800 (PST)\r
21 X-AuditID: 1209190e-b7f516d0000008e4-ec-50ccd7d2aebf\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 7F.06.02276.2D7DCC05; Sat, 15 Dec 2012 15:04:34 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id qBFK4WjI014730; \r
27         Sat, 15 Dec 2012 15:04:32 -0500\r
28 Received: from drake.dyndns.org\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qBFK4Sjj025683\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sat, 15 Dec 2012 15:04:31 -0500 (EST)\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1TjxyG-0007sV-LN; Sat, 15 Dec 2012 15:04:28 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v2 3/7] emacs: Factor out synchronous notmuch JSON invocations\r
41 Date: Sat, 15 Dec 2012 15:04:16 -0500\r
42 Message-Id: <1355601860-30121-4-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10.4\r
44 In-Reply-To: <1355601860-30121-1-git-send-email-amdragon@mit.edu>\r
45 References: <1355601860-30121-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nonvp+pkAg4VTVSxWz+WxuH5zJrPF\r
48         m5XzWB2YPXbOusvucfjrQhaPZ6tuMQcwR3HZpKTmZJalFunbJXBlXNp3h6ngjXjFm689jA2M\r
49         C4S7GDk5JARMJE63drBD2GISF+6tZ+ti5OIQEtjHKLHz/yJ2CGcDo8TMpxeYIZxHTBIHWh5C\r
50         lc1llNi2YTczSD+bgIbEtv3LGUFsEQFpiZ13Z7OC2MwCcRJbpvwHiwsL+Ek8efcfLM4ioCpx\r
51         sf8xG4jNK+Ag0bt0EQvEHYoS3c8mgMU5BRwlJk7exQRiCwHV3F4wh2kCI/8CRoZVjLIpuVW6\r
52         uYmZOcWpybrFyYl5ealFusZ6uZkleqkppZsYQeHFKcm3g/HrQaVDjAIcjEo8vDsiTgcIsSaW\r
53         FVfmHmKU5GBSEuXNuHwmQIgvKT+lMiOxOCO+qDQntfgQowQHs5IIb9J8oBxvSmJlVWpRPkxK\r
54         moNFSZz3SspNfyGB9MSS1OzU1ILUIpisDAeHkgSvEDCOhASLUtNTK9Iyc0oQ0kwcnCDDeYCG\r
55         c4DU8BYXJOYWZ6ZD5E8xKkqJ89qBJARAEhmleXC9sPh/xSgO9Iow74drQFU8wNQB1/0KaDAT\r
56         0ODlNmCDSxIRUlINjJGM/OVnPvvqMM1vWMx266j/jyu8payR0x94Cpk/2dM4N6ZP+mBenOcC\r
57         s3s51SIsmr7zfstI+Cd4xD7XPlVjsaDRZAnPvPmegTMMP8zUEeFhMN1wX+fX/iVr2loO+i1w\r
58         3nLS6tb16fNkuqMeHVcMyJXfEvz36KP5WpuCG/8v37REM9rOIrs1R4mlOCPRUIu5qDgRAO2H\r
59         aUzaAgAA\r
60 Cc: tomi.ollila@iki.fi\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Sat, 15 Dec 2012 20:04:38 -0000\r
74 \r
75 Previously this code was duplicated between show and reply.  This\r
76 factors out synchronously invoking notmuch and parsing the output as\r
77 JSON.\r
78 ---\r
79  emacs/notmuch-lib.el   |   14 ++++++++++++++\r
80  emacs/notmuch-mua.el   |    8 +-------\r
81  emacs/notmuch-query.el |   11 ++---------\r
82  3 files changed, 17 insertions(+), 16 deletions(-)\r
83 \r
84 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
85 index f757ce7..f534770 100644\r
86 --- a/emacs/notmuch-lib.el\r
87 +++ b/emacs/notmuch-lib.el\r
88 @@ -371,6 +371,20 @@ contents of ERR-FILE will be included in the error message."\r
89      ;; Mimic `process-lines'\r
90      (error "%s exited with status %s" (car command) exit-status))))\r
91  \r
92 +(defun notmuch-call-notmuch-json (&rest args)\r
93 +  "Invoke `notmuch-command' with `args' and return the parsed JSON output.\r
94 +\r
95 +The returned output will represent objects using property lists\r
96 +and arrays as lists."\r
97 +\r
98 +  (with-temp-buffer\r
99 +    (apply #'call-process notmuch-command nil (list t nil) nil args)\r
100 +    (goto-char (point-min))\r
101 +    (let ((json-object-type 'plist)\r
102 +         (json-array-type 'list)\r
103 +         (json-false 'nil))\r
104 +      (json-read))))\r
105 +\r
106  ;; Compatibility functions for versions of emacs before emacs 23.\r
107  ;;\r
108  ;; Both functions here were copied from emacs 23 with the following copyright:\r
109 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
110 index 408b49e..ac2d29e 100644\r
111 --- a/emacs/notmuch-mua.el\r
112 +++ b/emacs/notmuch-mua.el\r
113 @@ -158,13 +158,7 @@ list."\r
114      (setq args (append args (list query-string)))\r
115  \r
116      ;; Get the reply object as JSON, and parse it into an elisp object.\r
117 -    (with-temp-buffer\r
118 -      (apply 'call-process (append (list notmuch-command nil (list t nil) nil) args))\r
119 -      (goto-char (point-min))\r
120 -      (let ((json-object-type 'plist)\r
121 -           (json-array-type 'list)\r
122 -           (json-false 'nil))\r
123 -       (setq reply (json-read))))\r
124 +    (setq reply (apply #'notmuch-call-notmuch-json args))\r
125  \r
126      ;; Extract the original message to simplify the following code.\r
127      (setq original (plist-get reply :original))\r
128 diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el\r
129 index d66baea..e7e3520 100644\r
130 --- a/emacs/notmuch-query.el\r
131 +++ b/emacs/notmuch-query.el\r
132 @@ -29,18 +29,11 @@ A thread is a forest or list of trees. A tree is a two element\r
133  list where the first element is a message, and the second element\r
134  is a possibly empty forest of replies.\r
135  "\r
136 -  (let  ((args '("show" "--format=json"))\r
137 -        (json-object-type 'plist)\r
138 -        (json-array-type 'list)\r
139 -        (json-false 'nil))\r
140 +  (let ((args '("show" "--format=json")))\r
141      (if notmuch-show-process-crypto\r
142         (setq args (append args '("--decrypt"))))\r
143      (setq args (append args search-terms))\r
144 -    (with-temp-buffer\r
145 -      (progn\r
146 -       (apply 'call-process (append (list notmuch-command nil (list t nil) nil) args))\r
147 -       (goto-char (point-min))\r
148 -       (json-read)))))\r
149 +    (apply #'notmuch-call-notmuch-json args)))\r
150  \r
151  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
152  ;; Mapping functions across collections of messages.\r
153 -- \r
154 1.7.10.4\r
155 \r