1 Return-Path: <prvs=jrosenthal=72618203d@jhu.edu>
\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 B4DDC4196F2
\r
6 for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 18:33:16 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham
\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 j2N7u-591vep for <notmuch@notmuchmail.org>;
\r
16 Mon, 26 Apr 2010 18:33:15 -0700 (PDT)
\r
17 Received: from ipex4.johnshopkins.edu (ipex4.johnshopkins.edu
\r
19 by olra.theworths.org (Postfix) with ESMTP id 97697431FC1
\r
20 for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 18:33:15 -0700 (PDT)
\r
21 X-IronPort-AV: E=Sophos;i="4.52,276,1270440000"; d="scan'208";a="359678433"
\r
22 Received: from c-69-255-36-229.hsd1.md.comcast.net (HELO lucky)
\r
24 by ipex4.johnshopkins.edu with ESMTP/TLS/AES256-SHA;
\r
25 26 Apr 2010 21:33:14 -0400
\r
26 Received: from jkr by lucky with local (Exim 4.69)
\r
27 (envelope-from <jrosenthal@jhu.edu>)
\r
28 id 1O6Zfl-00084k-AD; Mon, 26 Apr 2010 21:33:13 -0400
\r
29 From: Jesse Rosenthal <jrosenthal@jhu.edu>
\r
30 To: Sebastian Spaeth <Sebastian@SSpaeth.de>,
\r
31 Notmuch developer list <notmuch@notmuchmail.org>
\r
32 Subject: [PATCH] emacs: add prompt to create maildir for fcc if it does not
\r
34 In-Reply-To: <87mxwpd9g8.fsf@jhu.edu>
\r
35 References: <m3bpd8tpjk.fsf@x200.gr8dns.org>
\r
36 <1272270198-28357-4-git-send-email-Sebastian@SSpaeth.de>
\r
37 <87mxwpd9g8.fsf@jhu.edu>
\r
38 User-Agent: Notmuch/0.2-151-gec6d78a (http://notmuchmail.org) Emacs/23.1.1
\r
40 Date: Mon, 26 Apr 2010 21:33:13 -0400
\r
41 Message-ID: <87wrvtvfvq.fsf@jhu.edu>
\r
43 Content-Type: text/plain; charset=us-ascii
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Tue, 27 Apr 2010 01:33:16 -0000
\r
59 If the user specifies a maildir that does not exist, prompt the user to
\r
60 see whether a maildir should be created. This will fail, with the
\r
61 relevant explanation, if the location is not writable, or if a file
\r
62 already exists in that location. If the location is a dir, but not a
\r
63 maildir, this will add /tmp/cur/new to it.
\r
65 NB. This builds on the patch in the parent email:
\r
66 id:87mxwpd9g8.fsf@jhu.edu
\r
68 emacs/notmuch-maildir-fcc.el | 26 ++++++++++++++++++++++----
\r
69 1 files changed, 22 insertions(+), 4 deletions(-)
\r
71 diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
\r
72 index 34b1915..6d75b11 100644
\r
73 --- a/emacs/notmuch-maildir-fcc.el
\r
74 +++ b/emacs/notmuch-maildir-fcc.el
\r
76 (if (eq subdir nil) (setq subdir (car (car notmuch-fcc-dirs))))
\r
77 (unless (message-fetch-field "fcc")
\r
78 (message-add-header (concat "Fcc: " message-directory subdir)))
\r
79 - (unless (notmuch-maildir-fcc-dir-is-maildir-p
\r
80 - (message-fetch-field "fcc"))
\r
81 - (error (format "%s is not a maildir." (message-fetch-field "fcc")))))))
\r
83 + (let ((fcc-header (message-fetch-field "fcc")))
\r
84 + (unless (notmuch-maildir-fcc-dir-is-maildir-p fcc-header)
\r
85 + (cond ((not (file-writable-p fcc-header))
\r
86 + (error (format "%s is not a maildir, but you don't have permission to create one." fcc-header)))
\r
87 + ((y-or-n-p (format "%s is not a maildir. Create it? "
\r
89 + (notmuch-maildir-fcc-create-maildir fcc-header))
\r
91 + (error "Not sending message."))))))))
\r
93 (defun notmuch-maildir-fcc-host-fixer (hostname)
\r
94 (replace-regexp-in-string "/\\|:"
\r
96 @@ -104,6 +110,18 @@
\r
97 (file-exists-p (concat dir "/new/"))
\r
98 (file-exists-p (concat dir "/tmp/"))))
\r
100 +(defun notmuch-maildir-fcc-create-maildir (path)
\r
101 + (cond ((or (not (file-exists-p path)) (file-directory-p path))
\r
102 + (make-directory (concat path "/cur/") t)
\r
103 + (make-directory (concat path "/new/") t)
\r
104 + (make-directory (concat path "/tmp/") t))
\r
105 + ((file-regular-p path)
\r
106 + (error "%s is a file. Can't creat maildir." path))
\r
108 + (error "I don't know how to create a maildir here"))))
\r
112 (defun notmuch-maildir-fcc-save-buffer-to-tmp (destdir)
\r
113 "Returns the msg id of the message written to the temp directory
\r
114 if successful, nil if not."
\r