Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 19 / 70c0847f6c7939e62ac657f78d38f9737900e0
1 Return-Path: <markwalters1009@gmail.com>\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 A0D856DE13F4\r
6  for <notmuch@notmuchmail.org>; Mon,  3 Aug 2015 00:46:16 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.852\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.852 tagged_above=-999 required=5\r
12  tests=[AWL=-1.026, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,\r
13  DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25,\r
14  FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
15  RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_SBL=0.644,\r
16  URIBL_SBL_A=0.1] autolearn=disabled\r
17 Received: from arlo.cworth.org ([127.0.0.1])\r
18  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
19  with ESMTP id E1MEzIx-1lNm for <notmuch@notmuchmail.org>;\r
20  Mon,  3 Aug 2015 00:46:12 -0700 (PDT)\r
21 Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
22  [209.85.212.173])\r
23  by arlo.cworth.org (Postfix) with ESMTPS id C30946DE13DB\r
24  for <notmuch@notmuchmail.org>; Mon,  3 Aug 2015 00:46:11 -0700 (PDT)\r
25 Received: by wibxm9 with SMTP id xm9so102121227wib.1\r
26  for <notmuch@notmuchmail.org>; Mon, 03 Aug 2015 00:46:09 -0700 (PDT)\r
27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
28  h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
29  :message-id:mime-version:content-type;\r
30  bh=Ig3og0ZGp/ecJEDzBh4pH9V2ulJBzIR/Dh+lpmP82z0=;\r
31  b=0MhARxu57tFtCmpu5tKrIbHW4nNRpSU+fz0f7AeXKP6TlUbUJGyGPfQIzJP2Y6Agfz\r
32  m+Rg0UTDRncHYL8LtBZybnNMneXI0y2LYrzcAyTfAe+15mgG488lffEvGtKgjN7yizJm\r
33  23lEpvna9Rw0uueuAVf5Ck9aEeYG44VOFwmC6VzaRx8k+pmP5qbKJ5tKQ3+IRrNWkW9h\r
34  frwT/w7LRuy/h3IML8h5ZXY/gcOnxLGazEd2W/HGdn7bKP8120H/XHh+9i3QRR8kwBMZ\r
35  PvB8UuSvwPWokMDeWp4hxfHwfIPQD+ciZaED33aq1X6zmz3IZENqrLyL0EnjEX/xTZQp\r
36  3tSg==\r
37 X-Received: by 10.194.190.79 with SMTP id go15mr30096970wjc.80.1438587969805; \r
38  Mon, 03 Aug 2015 00:46:09 -0700 (PDT)\r
39 Received: from localhost (188.29.71.109.threembb.co.uk. [188.29.71.109])\r
40  by smtp.gmail.com with ESMTPSA id s1sm12148134wix.13.2015.08.03.00.46.07\r
41  (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
42  Mon, 03 Aug 2015 00:46:09 -0700 (PDT)\r
43 From: Mark Walters <markwalters1009@gmail.com>\r
44 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
45 Subject: Re: [PATCH 2/2] emacs: make modifications to message Fcc vars\r
46  buffer-local\r
47 In-Reply-To: <1438422296-29087-3-git-send-email-david@tethera.net>\r
48 References: <87vbdrysd7.fsf@qmul.ac.uk>\r
49  <1438422296-29087-1-git-send-email-david@tethera.net>\r
50  <1438422296-29087-3-git-send-email-david@tethera.net>\r
51 User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1\r
52  (x86_64-pc-linux-gnu)\r
53 Date: Mon, 03 Aug 2015 08:46:05 +0100\r
54 Message-ID: <873800yfuq.fsf@qmul.ac.uk>\r
55 MIME-Version: 1.0\r
56 Content-Type: text/plain; charset=us-ascii\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.18\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61  <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Mon, 03 Aug 2015 07:46:16 -0000\r
70 \r
71 \r
72 On Sat, 01 Aug 2015, David Bremner <david@tethera.net> wrote:\r
73 > Previously we globally modified these variables, which tended to cause\r
74 > problems for people using message-mode, but not notmuch-mua-mail, to\r
75 > send mail.\r
76 \r
77 I think I like this approach: I think we will like the freedom to tweak\r
78 message-mode.\r
79 \r
80 > User visible changes:\r
81 >\r
82 > - calling notmuch-fcc-header-setup is no longer optional. OTOH, it\r
83 >   seems to do the right thing if notmuch-fcc-dirs is set to nil.\r
84 >\r
85 > - the Fcc header is visible during message composition\r
86 \r
87 These both seem good. At the moment notmuch-fcc-header-setup checks\r
88 whether the fcc directory is a valid maildir. This used to be called on\r
89 sending but is now called when the message composition is started. I\r
90 think it would be better to move it into notmuch-mua-send-and-exit or\r
91 (perhaps better) in notmuch-fcc-handler itself (in case the user edits\r
92 it).\r
93 \r
94 > - the name in the mode line is changed, and (sadface) no longer\r
95 >   matches the menu label.\r
96 \r
97 Do you mean the buffer name is *mail*? We could just call rename-buffer\r
98 somewhere (maybe in our derived mode bit?)\r
99 \r
100 > - Previously notmuch-mua-send-and-exit was never called.  Either we\r
101 >   misunderstood define-mail-user-agent, or it had a bug.  So there was\r
102 >   no difference if the user called message-send-and-exit directly. Now\r
103 >   there will be.\r
104 \r
105 This is a little irritating in case people have customised key bindings\r
106 but I don't see a way round it. \r
107 \r
108 A related case, which we probably should fix, is that C-c C-s is bound to\r
109 message send (and don't exit), this probably needs a wrapper too.\r
110 \r
111 Best wishes\r
112 \r
113 Mark\r
114 \r
115 \r
116 \r
117 \r
118 \r
119 > ---\r
120 >  emacs/notmuch-maildir-fcc.el | 23 +++++++++--------------\r
121 >  emacs/notmuch-mua.el         |  6 +++++-\r
122 >  test/test-lib.sh             |  4 ++--\r
123 >  3 files changed, 16 insertions(+), 17 deletions(-)\r
124 >\r
125 > diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el\r
126 > index 07eedba..c2f2f4c 100644\r
127 > --- a/emacs/notmuch-maildir-fcc.el\r
128 > +++ b/emacs/notmuch-maildir-fcc.el\r
129 > @@ -59,23 +59,19 @@ yet when sending a mail."\r
130 >   :require 'notmuch-fcc-initialization\r
131 >   :group 'notmuch-send)\r
132 >  \r
133 > -(defun notmuch-fcc-initialization ()\r
134 > -  "If notmuch-fcc-directories is set,\r
135 > -   hook them into the message-fcc-handler-function"\r
136 > -    ;; Set up the message-fcc-handler to move mails to the maildir in Fcc\r
137 > -    ;; The parameter is set to mark messages as "seen"\r
138 > -    (setq message-fcc-handler-function\r
139 > -          (lambda (destdir)\r
140 > -         (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))\r
141 > -    ;; add a hook to actually insert the Fcc header when sending\r
142 > -    (add-hook 'message-header-setup-hook 'notmuch-fcc-header-setup))\r
143 > +(defun notmuch-fcc-handler (destdir)\r
144 > +  "Write buffer to `destdir', marking it as sent\r
145 > +\r
146 > +Intended to be dynamically bound to `message-fcc-handler-function'"\r
147 > +    (notmuch-maildir-fcc-write-buffer-to-maildir destdir t))\r
148 >  \r
149 >  (defun notmuch-fcc-header-setup ()\r
150 >    "Add an Fcc header to the current message buffer.\r
151 >  \r
152 > -Can be added to `message-send-hook' and will set the Fcc header\r
153 > -based on the values of `notmuch-fcc-dirs'. An existing Fcc header\r
154 > -will NOT be removed or replaced."\r
155 > +Sets the Fcc header based on the values of `notmuch-fcc-dirs'.\r
156 > +\r
157 > +Originally intended to be use a hook function, but now called directly\r
158 > +by notmuch-mua-mail"\r
159 >  \r
160 >    (let ((subdir\r
161 >        (cond\r
162 > @@ -213,6 +209,5 @@ return t if successful, and nil otherwise."\r
163 >         (delete-file (concat destdir "/tmp/" msg-id))))\r
164 >        t)))\r
165 >  \r
166 > -(notmuch-fcc-initialization)\r
167 >  (provide 'notmuch-maildir-fcc)\r
168 >  \r
169 > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
170 > index a7d3eaa..4ae7d1e 100644\r
171 > --- a/emacs/notmuch-mua.el\r
172 > +++ b/emacs/notmuch-mua.el\r
173 > @@ -268,6 +268,8 @@ Note that these functions use `mail-citation-hook' if that is non-nil."\r
174 >  (define-derived-mode notmuch-compose-mode message-mode "notmuch-compose"\r
175 >    "Notmuch message composition mode. Mostly like `message-mode'")\r
176 >  \r
177 > +(define-key notmuch-compose-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit)\r
178 > +\r
179 >  (defun notmuch-mua-mail (&optional to subject other-headers &rest other-args)\r
180 >    "Invoke the notmuch mail composition window.\r
181 >  \r
182 > @@ -285,6 +287,7 @@ OTHER-ARGS are passed through to `message-mail'."\r
183 >  \r
184 >    (apply #'message-mail to subject other-headers other-args)\r
185 >    (notmuch-compose-mode)\r
186 > +  (notmuch-fcc-header-setup)\r
187 >    (message-sort-headers)\r
188 >    (message-hide-headers)\r
189 >    (set-buffer-modified-p nil)\r
190 > @@ -398,7 +401,8 @@ will be addressed to all recipients of the source message."\r
191 >  \r
192 >  (defun notmuch-mua-send-and-exit (&optional arg)\r
193 >    (interactive "P")\r
194 > -  (message-send-and-exit arg))\r
195 > +  (let ((message-fcc-handler-function #'notmuch-fcc-handler))\r
196 > +    (message-send-and-exit arg)))\r
197 >  \r
198 >  (defun notmuch-mua-kill-buffer ()\r
199 >    (interactive)\r
200 > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
201 > index 3466e9c..cb8a6cf 100644\r
202 > --- a/test/test-lib.sh\r
203 > +++ b/test/test-lib.sh\r
204 > @@ -487,7 +487,7 @@ emacs_deliver_message ()\r
205 >          (message-goto-body)\r
206 >          (insert \"${body}\")\r
207 >          $@\r
208 > -        (message-send-and-exit))"\r
209 > +        (notmuch-mua-send-and-exit))"\r
210 >  \r
211 >      # In case message was sent properly, client waits for confirmation\r
212 >      # before exiting and resuming control here; therefore making sure\r
213 > @@ -522,7 +522,7 @@ emacs_fcc_message ()\r
214 >          (message-goto-body)\r
215 >          (insert \"${body}\")\r
216 >          $@\r
217 > -        (message-send-and-exit))" || return 1\r
218 > +        (notmuch-mua-send-and-exit))" || return 1\r
219 >      notmuch new >/dev/null\r
220 >  }\r
221 >  \r
222 > -- \r
223 > 2.1.4\r