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