Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 81 / a38fbf1385cd66cb56ea60cc38dd383ed190f4
1 Return-Path: <anarcat@anarcat.ath.cx>\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 4C50D431FD0\r
6         for <notmuch@notmuchmail.org>; Mon,  8 Aug 2011 07:54:47 -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.614\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.614 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_SORBS_WEB=0.614] 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 phY01XN5T3Fb for <notmuch@notmuchmail.org>;\r
16         Mon,  8 Aug 2011 07:54:46 -0700 (PDT)\r
17 Received: from bureau.koumbit.net (homere.koumbit.net [209.44.112.81])\r
18         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 86948431FB6\r
21         for <notmuch@notmuchmail.org>; Mon,  8 Aug 2011 07:54:46 -0700 (PDT)\r
22 Received: from localhost (g229063022.adsl.alicedsl.de [92.229.63.22])\r
23         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
24         (No client certificate requested)\r
25         by bureau.koumbit.net (Postfix) with ESMTPSA id EFFD3E80485;\r
26         Mon,  8 Aug 2011 10:52:16 -0400 (EDT)\r
27 Received: by localhost (Postfix, from userid 1000)\r
28         id 0D514AC3D0; Mon,  8 Aug 2011 16:52:10 +0200 (CEST)\r
29 From: Antoine =?utf-8?Q?Beaupr=C3=A9?= <anarcat@koumbit.org>\r
30 To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
31         Xavier Maillard <xma@gnu.org>, Austin Clements <amdragon@mit.edu>\r
32 Subject: Re: [PATCH 2/2] add edit function to resume postponed emails\r
33 In-Reply-To: <87y5zrwb29.fsf@servo.factory.finestructure.net>\r
34 References: <1310807540-29960-1-git-send-email-anarcat@koumbit.org>\r
35         <1310841685-29167-1-git-send-email-anarcat@koumbit.org>\r
36         <CAH-f9Wtff0noP2-jxSmmhMRDWebt6G10Pe+3r-m6WvhDm_--ow@mail.gmail.com>\r
37         <874o2gskgk.fsf@marcos.anarcat.ath.cx>\r
38         <871uxk1vhf.fsf@servo.factory.finestructure.net>\r
39         <m24o2fnwtx.fsf@gnu.org>\r
40         <87y5zrwb29.fsf@servo.factory.finestructure.net>\r
41 User-Agent: Notmuch/0.7 (http://notmuchmail.org) Emacs/23.2.1\r
42         (i486-pc-linux-gnu)\r
43 Date: Mon, 08 Aug 2011 16:52:06 +0200\r
44 Message-ID: <87mxfklzvt.fsf@angela.anarcat.ath.cx>\r
45 MIME-Version: 1.0\r
46 Content-Type: multipart/signed; boundary="=-=-=";\r
47         micalg=pgp-sha256; protocol="application/pgp-signature"\r
48 Cc: notmuch@notmuchmail.org\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Mon, 08 Aug 2011 14:54:47 -0000\r
62 \r
63 --=-=-=\r
64 Content-Type: text/plain; charset=utf-8\r
65 Content-Transfer-Encoding: quoted-printable\r
66 \r
67 On Thu, 21 Jul 2011 14:58:22 -0700, Jameson Graef Rollins <jrollins@finestr=\r
68 ucture.net> wrote:\r
69 > As for resuming postponed messages, I have defined the following key\r
70 > binding, which I use on draft messages that have been indexed by\r
71 > notmuch:\r
72 [...]\r
73 \r
74 So I have improved on this, I believe. I now have this in my .emacs as\r
75 test code for a new postpone workflow. I have completely ditched my\r
76 older patches in favor of this approach.\r
77 \r
78 The general workflow is this:\r
79 \r
80  1. start writing an email\r
81  2. postpone it with C-c C-d, as usual\r
82    -> the mail gets saved to a (currently hardcoded) maildir mailbox\r
83  using the notmuch's FCC routines\r
84  3. notmuch new eventually happens (not ran automatically, maybe we should?)\r
85  4. load the "tag:draft" search or the above mailbox in some way or\r
86  another\r
87  5. show the draft you want to resume and hit R\r
88  6. finish editing the email and send it\r
89    -> the mail gets deleted from the maildir\r
90 \r
91 If instead of sending the mail the buffer is killed, the draft is left\r
92 alone.\r
93 \r
94 I can already think of a few improvements:\r
95 \r
96  * make variable for the draft folder\r
97  * automatically tag drafts with the draft tag (so notmuch new is not\r
98    necessary)\r
99  * hotkey for loading the draft search\r
100  * kill or save a draft (after confirmation) when killing a buffer\r
101 \r
102 It's still quite messy, but I wanted to share with the list here the\r
103 working code I had. I would welcome feedback on how to integrate this\r
104 into notmuch...\r
105 \r
106 Thanks!\r
107 \r
108 A.\r
109 \r
110 (defun anarcat/notmuch-message-setup ()\r
111   "Configures a bunch of hooks for notmuch message windows"\r
112   (message-add-action `(message "debug: done exit actions") 'exit)\r
113   (message-add-action `(message "debug: done postpone actions") 'postpone)\r
114   (message-add-action `(message "debug: done kill actions") 'kill)\r
115   (message-add-action 'notmuch-message-postpone-keep 'postpone)\r
116   (message-add-action 'notmuch-message-postpone-cleanup 'exit)\r
117 )\r
118 (add-hook 'message-mode-hook 'anarcat/notmuch-message-setup)\r
119 \r
120 (defun notmuch-message-postpone-cleanup ()\r
121   "Remove autosave and postponed messages for that buffer"\r
122   (message "debug: postpone cleanup hook")\r
123   (message "deleting draft file: %s" notmuch-draft-filename)\r
124   (if (file-exists-p notmuch-draft-filename)\r
125       (progn=20\r
126         (kill-buffer)\r
127         (delete-file notmuch-draft-filename)\r
128         (if (file-exists-p notmuch-draft-filename)\r
129             (message "failed to delete file %s" notmuch-draft-filename)\r
130           (message "debug: file deleted"))\r
131         )\r
132     (message "draft file %s doesn't exist" notmuch-draft-filename)))\r
133 \r
134 (defun notmuch-message-postpone-keep ()\r
135   "Moves the previous buffer into the postponed folder and then kill it"\r
136   ;; shouldn't be necessary: why the heck aren't we in the right buffer?\r
137   (save-excursion\r
138     (set-buffer (last-buffer))\r
139     (notmuch-maildir-fcc-write-buffer-to-maildir "~/Maildir/Anarcat/postpon=\r
140 ed/" t)\r
141     (kill-buffer))\r
142 )\r
143 \r
144 (defun notmuch-show-resume-message ()\r
145   "Resume a postponed message."\r
146   (interactive)\r
147   (setq tmpfilename (notmuch-show-get-filename))\r
148   (notmuch-show-view-raw-message)\r
149   (setq buffer-file-name tmpfilename)\r
150   (message "debug: set buffer file name to %s" buffer-file-name)\r
151   (setq notmuch-draft-filename buffer-file-name)\r
152   (make-local-variable 'notmuch-draft-filename)\r
153   (message "debug: set draft file name to %s" notmuch-draft-filename)\r
154   (message-mode))\r
155 \r
156 (define-key notmuch-show-mode-map "R" 'notmuch-show-resume-message)\r
157 \r
158 =2D-=20\r
159 O gentilshommes, la vie est courte.\r
160 Si nous vivons, nous vivons=20\r
161 pour marcher sur la t=C3=AAte des rois.\r
162                         - William Shakespeare\r
163 \r
164 --=-=-=\r
165 Content-Type: application/pgp-signature\r
166 \r
167 -----BEGIN PGP SIGNATURE-----\r
168 Version: GnuPG v1.4.10 (GNU/Linux)\r
169 \r
170 iQIcBAEBCAAGBQJOP/gWAAoJEHkhUlJ7dZIeLDsP/RKU+4LPTHT2zXxBIkrtqFEw\r
171 7r82at/XzhZGWPvnc/8ZsWjABiz+82UFsusiAtslaZhY6Ygeo/3SiYBpYcLWYSAw\r
172 eg9prTTkagqzshOyAKr5vN/3RGXhF0as7KMk+hCARrrAOZ9wDbOuyRopmCevHVRh\r
173 SCEnrS3XAai4FNNIiB19ewMg/pf2bQCyGWt3akb7pSCLKoNcMuqpVDAKZ00lpg5v\r
174 +bmhaicct3aP+6iCjDtYhy7J71XGmIGwv0SXPdG5hmdWh3/nIX0wmUcnCPd2l8IV\r
175 xq/KAk7C3+edSpsPsoQawUsKESl18mIK/lRZ5uzRj8uq0Gomsdwrj4Dmk3oy5gnr\r
176 f8N455OAXAGJfw7OeTk1v7XHoUwP+PH8gjdY4rrNmsnH3Y+Y9evlw6b4a0lA6VRY\r
177 bGn41dqOBvCGWUzPJMxoahvmCV5A2OCF+uov8ZhyZ358FYlPLyLxsFzDDSaMkLVF\r
178 ImP198fuy44ERSxQwRgaRLvuV+1Nv8FTv4j0ZIYS3Ynrg+lg9zom2BkC2qCqRNqz\r
179 eH/8ego74q0KqjJazNX+bCKTZnyIX4IjCi1o/Ps2jrf3hm6aCnlsb5MSSKZOP3Fa\r
180 4uNZm6Y6PCKeKKLjMncHREck7PzSaI0dunaEJPC9vKLPX3sGrjmsFF/eC4p0L2L7\r
181 S+KJ0IfhXhp3y0bmA/90\r
182 =fjvd\r
183 -----END PGP SIGNATURE-----\r
184 --=-=-=--\r