[PATCH] emacs: fcc should fail at the right time if it doesn't point to a maildir
authorJesse Rosenthal <jrosenthal@jhu.edu>
Tue, 27 Apr 2010 00:29:27 +0000 (20:29 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:57 +0000 (09:36 -0800)
a3/fd493b88dcb299a7d1f4975d8ee4f66f4f83ed [new file with mode: 0644]

diff --git a/a3/fd493b88dcb299a7d1f4975d8ee4f66f4f83ed b/a3/fd493b88dcb299a7d1f4975d8ee4f66f4f83ed
new file mode 100644 (file)
index 0000000..45a5885
--- /dev/null
@@ -0,0 +1,91 @@
+Return-Path: <prvs=jrosenthal=72618203d@jhu.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1B8404196F2\r
+       for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 17:29:31 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -4.2\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id KnPoNCZ-08Kc for <notmuch@notmuchmail.org>;\r
+       Mon, 26 Apr 2010 17:29:30 -0700 (PDT)\r
+Received: from ipex4.johnshopkins.edu (ipex4.johnshopkins.edu\r
+       [128.220.161.141])\r
+       by olra.theworths.org (Postfix) with ESMTP id E67C64196F0\r
+       for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 17:29:29 -0700 (PDT)\r
+X-IronPort-AV: E=Sophos;i="4.52,276,1270440000"; d="scan'208";a="359669145"\r
+Received: from c-69-255-36-229.hsd1.md.comcast.net (HELO lucky)\r
+       ([69.255.36.229])\r
+       by ipex4.johnshopkins.edu with ESMTP/TLS/AES256-SHA;\r
+       26 Apr 2010 20:29:28 -0400\r
+Received: from jkr by lucky with local (Exim 4.69)\r
+       (envelope-from <jrosenthal@jhu.edu>)\r
+       id 1O6Yg3-0007sj-Ja; Mon, 26 Apr 2010 20:29:27 -0400\r
+From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+To: Sebastian Spaeth <Sebastian@SSpaeth.de>,\r
+       Notmuch developer list <notmuch@notmuchmail.org>\r
+Subject: [PATCH] emacs: fcc should fail at the right time if it doesn't point\r
+       to a maildir\r
+In-Reply-To: <1272270198-28357-4-git-send-email-Sebastian@SSpaeth.de>\r
+References: <m3bpd8tpjk.fsf@x200.gr8dns.org>\r
+       <1272270198-28357-4-git-send-email-Sebastian@SSpaeth.de>\r
+User-Agent: Notmuch/0.2-151-gec6d78a (http://notmuchmail.org) Emacs/23.1.1\r
+       (i486-pc-linux-gnu)\r
+Date: Mon, 26 Apr 2010 20:29:27 -0400\r
+Message-ID: <87mxwpd9g8.fsf@jhu.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 27 Apr 2010 00:29:31 -0000\r
+\r
+Throw an error after the maildir is generated but before the message\r
+is sent. This change allows the user to edit the maildir if it fails,\r
+so that it will point to a correct place.\r
+\r
+Note that this changes the previous behavior which always overwrote\r
+the existing Fcc line. Now, an Fcc line is only auto-generated if\r
+there isn't one already there.\r
+\r
+The ideal change would be to prompt to create a maildir. This should\r
+enable a place for doing that in a future patch.\r
+---\r
+ emacs/notmuch-maildir-fcc.el |    7 +++++--\r
+ 1 files changed, 5 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el\r
+index 64f60bc..34b1915 100644\r
+--- a/emacs/notmuch-maildir-fcc.el\r
++++ b/emacs/notmuch-maildir-fcc.el\r
+@@ -70,8 +70,11 @@\r
+    (let ((subdir\r
+           (cdr (assoc-string (message-fetch-field "from") notmuch-fcc-dirs t))))\r
+      (if (eq subdir nil) (setq subdir (car (car notmuch-fcc-dirs))))\r
+-     (message-remove-header "Fcc")\r
+-     (message-add-header (concat "Fcc: " message-directory subdir)))))\r
++     (unless (message-fetch-field "fcc")\r
++       (message-add-header (concat "Fcc: " message-directory subdir)))\r
++     (unless (notmuch-maildir-fcc-dir-is-maildir-p \r
++            (message-fetch-field "fcc"))\r
++       (error (format "%s is not a maildir." (message-fetch-field "fcc")))))))\r
\r
+ (defun notmuch-maildir-fcc-host-fixer (hostname)\r
+   (replace-regexp-in-string "/\\|:"\r
+-- \r
+1.6.3.3\r
+\r