1 Return-Path: <bremner@tesseract.cs.unb.ca>
\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 arlo.cworth.org (Postfix) with ESMTP id 206076DE17F0
\r
6 for <notmuch@notmuchmail.org>; Sat, 1 Aug 2015 02:47:10 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.153 tagged_above=-999 required=5 tests=[AWL=0.143,
\r
12 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id rshqtIHSmXOJ for <notmuch@notmuchmail.org>;
\r
16 Sat, 1 Aug 2015 02:47:08 -0700 (PDT)
\r
17 Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])
\r
18 by arlo.cworth.org (Postfix) with ESMTPS id 5AD726DE17EB
\r
19 for <notmuch@notmuchmail.org>; Sat, 1 Aug 2015 02:47:08 -0700 (PDT)
\r
20 Received: from remotemail by gitolite.debian.net with local (Exim 4.80)
\r
21 (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
22 id 1ZLTM8-0004tX-30; Sat, 01 Aug 2015 09:45:28 +0000
\r
23 Received: (nullmailer pid 29361 invoked by uid 1000); Sat, 01 Aug 2015
\r
25 From: David Bremner <david@tethera.net>
\r
26 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
27 Subject: [PATCH 2/2] emacs: make modifications to message Fcc vars
\r
29 Date: Sat, 1 Aug 2015 11:44:56 +0200
\r
30 Message-Id: <1438422296-29087-3-git-send-email-david@tethera.net>
\r
31 X-Mailer: git-send-email 2.1.4
\r
32 In-Reply-To: <1438422296-29087-1-git-send-email-david@tethera.net>
\r
33 References: <87vbdrysd7.fsf@qmul.ac.uk>
\r
34 <1438422296-29087-1-git-send-email-david@tethera.net>
\r
35 X-BeenThere: notmuch@notmuchmail.org
\r
36 X-Mailman-Version: 2.1.18
\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: Sat, 01 Aug 2015 09:47:10 -0000
\r
49 Previously we globally modified these variables, which tended to cause
\r
50 problems for people using message-mode, but not notmuch-mua-mail, to
\r
53 User visible changes:
\r
55 - calling notmuch-fcc-header-setup is no longer optional. OTOH, it
\r
56 seems to do the right thing if notmuch-fcc-dirs is set to nil.
\r
58 - the Fcc header is visible during message composition
\r
60 - the name in the mode line is changed, and (sadface) no longer
\r
61 matches the menu label.
\r
63 - Previously notmuch-mua-send-and-exit was never called. Either we
\r
64 misunderstood define-mail-user-agent, or it had a bug. So there was
\r
65 no difference if the user called message-send-and-exit directly. Now
\r
68 emacs/notmuch-maildir-fcc.el | 23 +++++++++--------------
\r
69 emacs/notmuch-mua.el | 6 +++++-
\r
70 test/test-lib.sh | 4 ++--
\r
71 3 files changed, 16 insertions(+), 17 deletions(-)
\r
73 diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
\r
74 index 07eedba..c2f2f4c 100644
\r
75 --- a/emacs/notmuch-maildir-fcc.el
\r
76 +++ b/emacs/notmuch-maildir-fcc.el
\r
77 @@ -59,23 +59,19 @@ yet when sending a mail."
\r
78 :require 'notmuch-fcc-initialization
\r
79 :group 'notmuch-send)
\r
81 -(defun notmuch-fcc-initialization ()
\r
82 - "If notmuch-fcc-directories is set,
\r
83 - hook them into the message-fcc-handler-function"
\r
84 - ;; Set up the message-fcc-handler to move mails to the maildir in Fcc
\r
85 - ;; The parameter is set to mark messages as "seen"
\r
86 - (setq message-fcc-handler-function
\r
88 - (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
\r
89 - ;; add a hook to actually insert the Fcc header when sending
\r
90 - (add-hook 'message-header-setup-hook 'notmuch-fcc-header-setup))
\r
91 +(defun notmuch-fcc-handler (destdir)
\r
92 + "Write buffer to `destdir', marking it as sent
\r
94 +Intended to be dynamically bound to `message-fcc-handler-function'"
\r
95 + (notmuch-maildir-fcc-write-buffer-to-maildir destdir t))
\r
97 (defun notmuch-fcc-header-setup ()
\r
98 "Add an Fcc header to the current message buffer.
\r
100 -Can be added to `message-send-hook' and will set the Fcc header
\r
101 -based on the values of `notmuch-fcc-dirs'. An existing Fcc header
\r
102 -will NOT be removed or replaced."
\r
103 +Sets the Fcc header based on the values of `notmuch-fcc-dirs'.
\r
105 +Originally intended to be use a hook function, but now called directly
\r
106 +by notmuch-mua-mail"
\r
110 @@ -213,6 +209,5 @@ return t if successful, and nil otherwise."
\r
111 (delete-file (concat destdir "/tmp/" msg-id))))
\r
114 -(notmuch-fcc-initialization)
\r
115 (provide 'notmuch-maildir-fcc)
\r
117 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
\r
118 index a7d3eaa..4ae7d1e 100644
\r
119 --- a/emacs/notmuch-mua.el
\r
120 +++ b/emacs/notmuch-mua.el
\r
121 @@ -268,6 +268,8 @@ Note that these functions use `mail-citation-hook' if that is non-nil."
\r
122 (define-derived-mode notmuch-compose-mode message-mode "notmuch-compose"
\r
123 "Notmuch message composition mode. Mostly like `message-mode'")
\r
125 +(define-key notmuch-compose-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit)
\r
127 (defun notmuch-mua-mail (&optional to subject other-headers &rest other-args)
\r
128 "Invoke the notmuch mail composition window.
\r
130 @@ -285,6 +287,7 @@ OTHER-ARGS are passed through to `message-mail'."
\r
132 (apply #'message-mail to subject other-headers other-args)
\r
133 (notmuch-compose-mode)
\r
134 + (notmuch-fcc-header-setup)
\r
135 (message-sort-headers)
\r
136 (message-hide-headers)
\r
137 (set-buffer-modified-p nil)
\r
138 @@ -398,7 +401,8 @@ will be addressed to all recipients of the source message."
\r
140 (defun notmuch-mua-send-and-exit (&optional arg)
\r
142 - (message-send-and-exit arg))
\r
143 + (let ((message-fcc-handler-function #'notmuch-fcc-handler))
\r
144 + (message-send-and-exit arg)))
\r
146 (defun notmuch-mua-kill-buffer ()
\r
148 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
149 index 3466e9c..cb8a6cf 100644
\r
150 --- a/test/test-lib.sh
\r
151 +++ b/test/test-lib.sh
\r
152 @@ -487,7 +487,7 @@ emacs_deliver_message ()
\r
153 (message-goto-body)
\r
154 (insert \"${body}\")
\r
156 - (message-send-and-exit))"
\r
157 + (notmuch-mua-send-and-exit))"
\r
159 # In case message was sent properly, client waits for confirmation
\r
160 # before exiting and resuming control here; therefore making sure
\r
161 @@ -522,7 +522,7 @@ emacs_fcc_message ()
\r
162 (message-goto-body)
\r
163 (insert \"${body}\")
\r
165 - (message-send-and-exit))" || return 1
\r
166 + (notmuch-mua-send-and-exit))" || return 1
\r
167 notmuch new >/dev/null
\r