1 Return-Path: <sandra.snan@handgranat.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 7B6C7404948
\r
6 for <notmuch@notmuchmail.org>; Tue, 16 Mar 2010 12:48:03 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.307 tagged_above=-999 required=5 tests=[AWL=0.292,
\r
12 BAYES_00=-2.599] autolearn=ham
\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 bxFKZJVGaHRJ for <notmuch@notmuchmail.org>;
\r
16 Tue, 16 Mar 2010 12:48:02 -0700 (PDT)
\r
17 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id 65B9E404947
\r
20 for <notmuch@notmuchmail.org>; Tue, 16 Mar 2010 12:48:02 -0700 (PDT)
\r
21 Received: by wyf28 with SMTP id 28so168823wyf.26
\r
22 for <notmuch@notmuchmail.org>; Tue, 16 Mar 2010 12:48:01 -0700 (PDT)
\r
23 Received: by 10.216.171.138 with SMTP id r10mr21454wel.153.1268768717447;
\r
24 Tue, 16 Mar 2010 12:45:17 -0700 (PDT)
\r
25 Received: from ellen.idiomdrottning.org.handgranat.org
\r
26 (c83-251-93-216.bredband.comhem.se [83.251.93.216])
\r
27 by mx.google.com with ESMTPS id 13sm3559099ewy.1.2010.03.16.12.45.16
\r
28 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
29 Tue, 16 Mar 2010 12:45:16 -0700 (PDT)
\r
30 Message-ID: <4b9fdfcc.0d67f10a.3316.390d@mx.google.com>
\r
31 Date: Tue, 16 Mar 2010 20:46:39 +0100
\r
32 From: Sandra Snan <sandra.snan@handgranat.org>
\r
33 To: notmuch@notmuchmail.org
\r
34 User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9
\r
35 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.1 (x86_64-pc-linux-gnu)
\r
36 MULE/6.0 (HANACHIRUSATO)
\r
37 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")
\r
38 Content-Type: text/plain; charset=UTF-8
\r
39 Content-Transfer-Encoding: quoted-printable
\r
40 Subject: [notmuch] [PATCH] To use compose-mail and mail-citation-hook
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\r
44 List-Id: "Use and development of the notmuch mail system."
\r
45 <notmuch.notmuchmail.org>
\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
49 List-Post: <mailto:notmuch@notmuchmail.org>
\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
53 X-List-Received-Date: Tue, 16 Mar 2010 19:48:03 -0000
\r
55 Emacs has an interface called compose-mail which uses whatever mailing mode=
\r
56 that you=E2=80=99ve selected in mail-user-agent
\r
57 so if you like the message mode that=E2=80=99s been hard-coded into notmuch=
\r
58 .el, (setq mail-user-agent 'message-user-agent) and this will use that.
\r
59 This version of the patch also tries to yank the body text, calling mail-ci=
\r
60 tation-hook as it does so it works with mu-cite, supercite, trivialcite and=
\r
61 so on. I guess I started yak-shaving a bit too much because I kinda began =
\r
62 to reconstruct the output of notmuch reply via emacs lisp.
\r
64 I=E2=80=99ll send another e-mail with the patch for just compose-mail witho=
\r
65 ut the mail-citation-hook, too. These patches are mutually exclusive. I=E2=
\r
66 =80=99m not used to git so I hope this is all right.
\r
70 Signed-off-by: Sandra Snan <sandra.snan@handgranat.org>
\r
72 emacs/notmuch.el | 66 +++++++++++++++++++++++++++++++++++++++++++-------=
\r
74 1 files changed, 53 insertions(+), 13 deletions(-)
\r
76 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
77 index 117a365..68e2d43 100644
\r
78 --- a/emacs/notmuch.el
\r
79 +++ b/emacs/notmuch.el
\r
85 +(require 'message) ; not sure if this is needed now
\r
87 (defvar notmuch-show-stash-map
\r
88 (let ((map (make-sparse-keymap)))
\r
90 (define-key map (kbd "M-TAB") 'notmuch-show-previous-button)
\r
91 (define-key map (kbd "TAB") 'notmuch-show-next-button)
\r
92 (define-key map "s" 'notmuch-search)
\r
93 - (define-key map "m" 'message-mail)
\r
94 + (define-key map "m" 'compose-mail)
\r
95 (define-key map "f" 'notmuch-show-forward-current)
\r
96 (define-key map "r" 'notmuch-show-reply)
\r
97 (define-key map "|" 'notmuch-show-pipe-message)
\r
98 @@ -435,16 +435,56 @@ buffer."
\r
99 mm-handle (> (notmuch-count-attachments mm-handle) 1))))
\r
102 -(defun notmuch-reply (query-string)
\r
103 - (switch-to-buffer (generate-new-buffer "notmuch-draft"))
\r
104 - (call-process notmuch-command nil t nil "reply" query-string)
\r
105 - (message-insert-signature)
\r
107 +(defun jump-to-end-of-header ()
\r
108 + (re-search-forward "^[^:]*.: \\|^$")
\r
109 + (beginning-of-line)
\r
113 +(defun notmuch-regex-header (re)
\r
114 (goto-char (point-min))
\r
115 - (if (re-search-forward "^$" nil t)
\r
117 - (insert "--text follows this line--")
\r
120 + (if (re-search-forward re nil t)
\r
121 + (buffer-substring-no-properties (point) (jump-to-end-of-header))
\r
124 +(defun notmuch-other-headers (al)
\r
125 + (beginning-of-line)
\r
126 + (if (eq (point-at-bol) (point-at-eol))
\r
128 + (if (re-search-forward "^[^:]*.: \\|^$" nil t)
\r
129 + (notmuch-other-headers
\r
130 + (let ((header (buffer-substring-no-properties (point-at-bol) (- (point)=
\r
132 + (header-value (buffer-substring-no-properties (point) (jump-to-end-of-he=
\r
135 + (if (or (string=3D "To" header) (string=3D "Subject" header))
\r
143 +(defun notmuch-reply (query-string)
\r
146 + (let ((filename (notmuch-show-get-filename)))
\r
147 + (with-temp-buffer
\r
148 + (insert-file-contents filename)
\r
149 + (set-mark (point-max))
\r
150 + (goto-char (point-min))
\r
151 + (run-hooks 'mail-citation-hook)
\r
152 + (message-insert-signature) ;; FIXME is there a standard hook for s=
\r
154 + (buffer-substring (point-min) (point-max)))))))
\r
155 + (with-temp-buffer
\r
156 + (call-process notmuch-command nil t nil "reply" query-string)
\r
158 + (notmuch-regex-header "^To: ")
\r
159 + (notmuch-regex-header "^Subject: ")
\r
160 + (progn (goto-char (point-min))
\r
161 + (notmuch-other-headers '())))
\r
162 + (goto-char (point-max))
\r
165 (defun notmuch-show-reply ()
\r
166 "Begin composing a reply to the current message in a new buffer."
\r
167 @@ -1229,7 +1269,7 @@ matching this search term are shown if non-nil. "
\r
168 (define-key map "p" 'notmuch-search-previous-thread)
\r
169 (define-key map "n" 'notmuch-search-next-thread)
\r
170 (define-key map "r" 'notmuch-search-reply-to-thread)
\r
171 - (define-key map "m" 'message-mail)
\r
172 + (define-key map "m" 'compose-mail)
\r
173 (define-key map "s" 'notmuch-search)
\r
174 (define-key map "o" 'notmuch-search-toggle-order)
\r
175 (define-key map "=3D" 'notmuch-search-refresh-view)
\r
176 @@ -1651,7 +1691,7 @@ current search results AND that are tagged with the g=
\r
178 (define-key map "?" 'notmuch-help)
\r
179 (define-key map "x" 'kill-this-buffer)
\r
180 (define-key map "q" 'kill-this-buffer)
\r
181 - (define-key map "m" 'message-mail)
\r
182 + (define-key map "m" 'compose-mail)
\r
183 (define-key map "e" 'notmuch-folder-show-empty-toggle)
\r
184 (define-key map ">" 'notmuch-folder-last)
\r
185 (define-key map "<" 'notmuch-folder-first)
\r