[PATCH] emacs: implement notmuch-search-color-line with dolist.
[notmuch-archives.git] / 59 / 00d191590df6c65325304c464f12d0747b7618
1 Return-Path: <dme@dme.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 CB93C431FD0\r
6         for <notmuch@notmuchmail.org>; Fri,  9 May 2014 01:22:37 -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.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 NMzZoLGJPQLv for <notmuch@notmuchmail.org>;\r
16         Fri,  9 May 2014 01:22:33 -0700 (PDT)\r
17 Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com\r
18  [74.125.82.51])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  17B1B431FC2    for <notmuch@notmuchmail.org>; Fri,  9 May 2014 01:22:29 -0700\r
21  (PDT)\r
22 Received: by mail-wg0-f51.google.com with SMTP id x13so3647861wgg.22\r
23         for <notmuch@notmuchmail.org>; Fri, 09 May 2014 01:22:26 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=1e100.net; s=20130820;\r
26         h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\r
27         :references;\r
28         bh=oK8CjsG2vUKOfbQP7wpxaFip1nDBUHaD7V37BjIVB74=;\r
29         b=ZKaPS5xLEpX3WOGy/5SscouStixE/oADQBmiu4ujWNItcWaXxP+2XlBzyF/vJOI7BE\r
30         SIdFrRgBJD4ftrdfMT+0BCJpcvkf571pDFD1ZvasRZ6COxIuOSfHxQqVqlVbhbGLIY1D\r
31         j6JYJJou6wXDb49m19IsF22uc7NUVoO3u4wmmIimZ4JWPsh7Jx6D7m2FpBMcVepTe+dv\r
32         lqufBgw8TTeCfE1Z0oBmjwL9oOp5gR5WLs218nKt5gKvnt20GXQHf4BT6lAzG+FAodJy\r
33         Oa6SiZ4JP7DPxJW/i4AmYRLEse2VdXGhDoVHSCYPY5ka/Pi2UTRc8pYKXLFOb4uebuhV\r
34         8CCQ==\r
35 X-Gm-Message-State:\r
36  ALoCoQkf/YVRj3LVFrjONi3tlOV8RuhECd3RAAd3VguYSV86AlFxCBl8Elj4+cc9BUQNpmrX3gH9\r
37 X-Received: by 10.194.92.81 with SMTP id ck17mr7381281wjb.14.1399623746643;\r
38         Fri, 09 May 2014 01:22:26 -0700 (PDT)\r
39 Received: from hotblack-desiato.hh.sledj.net\r
40         ([2a01:348:1a2:1:a288:b4ff:fe8a:77d8])\r
41         by mx.google.com with ESMTPSA id\r
42         lj15sm3810945wic.13.2014.05.09.01.22.25 for <notmuch@notmuchmail.org>\r
43         (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
44         Fri, 09 May 2014 01:22:25 -0700 (PDT)\r
45 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
46         id 1833410920F; Fri,  9 May 2014 09:22:23 +0100 (BST)\r
47 From: David Edmondson <dme@dme.org>\r
48 To: notmuch@notmuchmail.org\r
49 Subject: [PATCH v1 3/3] emacs: Add `notmuch-show-save-message' to save\r
50  messages\r
51 Date: Fri,  9 May 2014 09:22:23 +0100\r
52 Message-Id: <1399623743-30478-4-git-send-email-dme@dme.org>\r
53 X-Mailer: git-send-email 2.0.0.rc0\r
54 In-Reply-To: <1399623743-30478-1-git-send-email-dme@dme.org>\r
55 References: <1399623743-30478-1-git-send-email-dme@dme.org>\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Fri, 09 May 2014 08:22:38 -0000\r
69 \r
70 Following `notmuch-show-pipe-message', add a binding 'S' to save\r
71 either the current or all open messages, depending on prefix argument.\r
72 ---\r
73  emacs/notmuch-show.el | 24 +++++++++++++++++++++++-\r
74  1 file changed, 23 insertions(+), 1 deletion(-)\r
75 \r
76 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
77 index 62c0be6..851e968 100644\r
78 --- a/emacs/notmuch-show.el\r
79 +++ b/emacs/notmuch-show.el\r
80 @@ -1285,6 +1285,7 @@ reset based on the original query."\r
81      (define-key map "f" 'notmuch-show-forward-message)\r
82      (define-key map "r" 'notmuch-show-reply-sender)\r
83      (define-key map "R" 'notmuch-show-reply)\r
84 +    (define-key map "S" 'notmuch-show-save-message)\r
85      (define-key map "|" 'notmuch-show-pipe-message)\r
86      (define-key map "w" 'notmuch-show-save-attachments)\r
87      (define-key map "V" 'notmuch-show-view-raw-message)\r
88 @@ -1769,6 +1770,24 @@ to show, nil otherwise."\r
89      (set-buffer-modified-p nil)\r
90      (view-buffer buf 'kill-buffer-if-not-modified)))\r
91  \r
92 +(put 'notmuch-show-save-message 'notmuch-doc\r
93 +     "Save the contents of the current message to a file.")\r
94 +(put 'notmuch-show-save-message 'notmuch-prefix-doc\r
95 +     "Save the thread as an mbox to a file.")\r
96 +(defun notmuch-show-save-message (entire-thread file)\r
97 +  "Save the contents of the current message (or thread) to FILE.\r
98 +\r
99 +If ENTIRE-THREAD is non-nil (or when invoked with a prefix\r
100 +argument), FILE will contain all open messages in the current\r
101 +thread (formatted as an mbox) rather than only the current\r
102 +message."\r
103 +  (interactive (let ((prompt (if current-prefix-arg\r
104 +                                "Save all open messages to file: "\r
105 +                              "Save message to command: ")))\r
106 +                (list current-prefix-arg (read-file-name prompt))))\r
107 +\r
108 +  (notmuch-show-pipe-message-internal entire-thread (concat " > " file)))\r
109 +\r
110  (put 'notmuch-show-pipe-message 'notmuch-doc\r
111       "Pipe the contents of the current message to a command.")\r
112  (put 'notmuch-show-pipe-message 'notmuch-prefix-doc\r
113 @@ -1789,6 +1808,9 @@ message."\r
114                                "Pipe message to command: ")))\r
115                  (list current-prefix-arg (read-string prompt))))\r
116  \r
117 +  (notmuch-show-pipe-message-internal entire-thread (concat " | " command)))\r
118 +\r
119 +(defun notmuch-show-pipe-message-internal (entire-thread command-tail)\r
120    (let ((shell-command\r
121          (concat notmuch-command " show"\r
122                  (if entire-thread\r
123 @@ -1796,7 +1818,7 @@ message."\r
124                              (mapconcat #'shell-quote-argument (notmuch-show-get-message-ids-for-open-messages) " OR "))\r
125                    (concat " --format=raw "\r
126                            (shell-quote-argument (notmuch-show-get-message-id))))\r
127 -                " | " command))\r
128 +                command-tail))\r
129         (cwd default-directory)\r
130         (buf (get-buffer-create (concat "*notmuch-pipe*"))))\r
131      (with-current-buffer buf\r
132 -- \r
133 2.0.0.rc0\r
134 \r