[PATCH] emacs: fcc should fail at the right time if it doesn't point to a maildir

2010-04-27 Thread Carl Worth
On Mon, 26 Apr 2010 20:29:27 -0400, Jesse Rosenthal  
wrote:
> 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.

Very nice. Just in time for 0.3, I merged this in, (and the 2
followups).

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[PATCH] emacs: fcc should fail at the right time if it doesn't point to a maildir

2010-04-26 Thread Dirk Hohndel
On Mon, 26 Apr 2010 20:29:27 -0400, Jesse Rosenthal  
wrote:
> 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.

I like this behavior

> The ideal change would be to prompt to create a maildir. This should
> enable a place for doing that in a future patch.

It would also be nice to catch the common mistake of not ending the
message-directory with a /

/D


-- 
Dirk Hohndel
Intel Open Source Technology Center


[PATCH] emacs: fcc should fail at the right time if it doesn't point to a maildir

2010-04-26 Thread Jesse Rosenthal
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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: fcc should fail at the right time if it doesn't point to a maildir

2010-04-26 Thread Dirk Hohndel
On Mon, 26 Apr 2010 20:29:27 -0400, Jesse Rosenthal jrosent...@jhu.edu wrote:
 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.

I like this behavior
 
 The ideal change would be to prompt to create a maildir. This should
 enable a place for doing that in a future patch.

It would also be nice to catch the common mistake of not ending the
message-directory with a /

/D


-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch