Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4C50D431FD0 for ; Mon, 8 Aug 2011 07:54:47 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.614 X-Spam-Level: X-Spam-Status: No, score=0.614 tagged_above=-999 required=5 tests=[RCVD_IN_SORBS_WEB=0.614] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id phY01XN5T3Fb for ; Mon, 8 Aug 2011 07:54:46 -0700 (PDT) Received: from bureau.koumbit.net (homere.koumbit.net [209.44.112.81]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 86948431FB6 for ; Mon, 8 Aug 2011 07:54:46 -0700 (PDT) Received: from localhost (g229063022.adsl.alicedsl.de [92.229.63.22]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by bureau.koumbit.net (Postfix) with ESMTPSA id EFFD3E80485; Mon, 8 Aug 2011 10:52:16 -0400 (EDT) Received: by localhost (Postfix, from userid 1000) id 0D514AC3D0; Mon, 8 Aug 2011 16:52:10 +0200 (CEST) From: Antoine =?utf-8?Q?Beaupr=C3=A9?= To: Jameson Graef Rollins , Xavier Maillard , Austin Clements Subject: Re: [PATCH 2/2] add edit function to resume postponed emails In-Reply-To: <87y5zrwb29.fsf@servo.factory.finestructure.net> References: <1310807540-29960-1-git-send-email-anarcat@koumbit.org> <1310841685-29167-1-git-send-email-anarcat@koumbit.org> <874o2gskgk.fsf@marcos.anarcat.ath.cx> <871uxk1vhf.fsf@servo.factory.finestructure.net> <87y5zrwb29.fsf@servo.factory.finestructure.net> User-Agent: Notmuch/0.7 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Mon, 08 Aug 2011 16:52:06 +0200 Message-ID: <87mxfklzvt.fsf@angela.anarcat.ath.cx> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 14:54:47 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, 21 Jul 2011 14:58:22 -0700, Jameson Graef Rollins wrote: > As for resuming postponed messages, I have defined the following key > binding, which I use on draft messages that have been indexed by > notmuch: [...] So I have improved on this, I believe. I now have this in my .emacs as test code for a new postpone workflow. I have completely ditched my older patches in favor of this approach. The general workflow is this: 1. start writing an email 2. postpone it with C-c C-d, as usual -> the mail gets saved to a (currently hardcoded) maildir mailbox using the notmuch's FCC routines 3. notmuch new eventually happens (not ran automatically, maybe we should?) 4. load the "tag:draft" search or the above mailbox in some way or another 5. show the draft you want to resume and hit R 6. finish editing the email and send it -> the mail gets deleted from the maildir If instead of sending the mail the buffer is killed, the draft is left alone. I can already think of a few improvements: * make variable for the draft folder * automatically tag drafts with the draft tag (so notmuch new is not necessary) * hotkey for loading the draft search * kill or save a draft (after confirmation) when killing a buffer It's still quite messy, but I wanted to share with the list here the working code I had. I would welcome feedback on how to integrate this into notmuch... Thanks! A. (defun anarcat/notmuch-message-setup () "Configures a bunch of hooks for notmuch message windows" (message-add-action `(message "debug: done exit actions") 'exit) (message-add-action `(message "debug: done postpone actions") 'postpone) (message-add-action `(message "debug: done kill actions") 'kill) (message-add-action 'notmuch-message-postpone-keep 'postpone) (message-add-action 'notmuch-message-postpone-cleanup 'exit) ) (add-hook 'message-mode-hook 'anarcat/notmuch-message-setup) (defun notmuch-message-postpone-cleanup () "Remove autosave and postponed messages for that buffer" (message "debug: postpone cleanup hook") (message "deleting draft file: %s" notmuch-draft-filename) (if (file-exists-p notmuch-draft-filename) (progn=20 (kill-buffer) (delete-file notmuch-draft-filename) (if (file-exists-p notmuch-draft-filename) (message "failed to delete file %s" notmuch-draft-filename) (message "debug: file deleted")) ) (message "draft file %s doesn't exist" notmuch-draft-filename))) (defun notmuch-message-postpone-keep () "Moves the previous buffer into the postponed folder and then kill it" ;; shouldn't be necessary: why the heck aren't we in the right buffer? (save-excursion (set-buffer (last-buffer)) (notmuch-maildir-fcc-write-buffer-to-maildir "~/Maildir/Anarcat/postpon= ed/" t) (kill-buffer)) ) (defun notmuch-show-resume-message () "Resume a postponed message." (interactive) (setq tmpfilename (notmuch-show-get-filename)) (notmuch-show-view-raw-message) (setq buffer-file-name tmpfilename) (message "debug: set buffer file name to %s" buffer-file-name) (setq notmuch-draft-filename buffer-file-name) (make-local-variable 'notmuch-draft-filename) (message "debug: set draft file name to %s" notmuch-draft-filename) (message-mode)) (define-key notmuch-show-mode-map "R" 'notmuch-show-resume-message) =2D-=20 O gentilshommes, la vie est courte. Si nous vivons, nous vivons=20 pour marcher sur la t=C3=AAte des rois. - William Shakespeare --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBCAAGBQJOP/gWAAoJEHkhUlJ7dZIeLDsP/RKU+4LPTHT2zXxBIkrtqFEw 7r82at/XzhZGWPvnc/8ZsWjABiz+82UFsusiAtslaZhY6Ygeo/3SiYBpYcLWYSAw eg9prTTkagqzshOyAKr5vN/3RGXhF0as7KMk+hCARrrAOZ9wDbOuyRopmCevHVRh SCEnrS3XAai4FNNIiB19ewMg/pf2bQCyGWt3akb7pSCLKoNcMuqpVDAKZ00lpg5v +bmhaicct3aP+6iCjDtYhy7J71XGmIGwv0SXPdG5hmdWh3/nIX0wmUcnCPd2l8IV xq/KAk7C3+edSpsPsoQawUsKESl18mIK/lRZ5uzRj8uq0Gomsdwrj4Dmk3oy5gnr f8N455OAXAGJfw7OeTk1v7XHoUwP+PH8gjdY4rrNmsnH3Y+Y9evlw6b4a0lA6VRY bGn41dqOBvCGWUzPJMxoahvmCV5A2OCF+uov8ZhyZ358FYlPLyLxsFzDDSaMkLVF ImP198fuy44ERSxQwRgaRLvuV+1Nv8FTv4j0ZIYS3Ynrg+lg9zom2BkC2qCqRNqz eH/8ego74q0KqjJazNX+bCKTZnyIX4IjCi1o/Ps2jrf3hm6aCnlsb5MSSKZOP3Fa 4uNZm6Y6PCKeKKLjMncHREck7PzSaI0dunaEJPC9vKLPX3sGrjmsFF/eC4p0L2L7 S+KJ0IfhXhp3y0bmA/90 =fjvd -----END PGP SIGNATURE----- --=-=-=--