For message-fetch-field the buffer is expected to be narrowed to
just the header of the message. That is not the case when
notmuch-fcc-header-setup is run, hence a wrong header value may be
returned. E.g. when forwarding an
email, (message-fetch-field "From") returns the From header value
of the forwarded email.
Message-field-value is the same as message-fetch-field, only
narrows the buffer to the headers first.
Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
Appease the test suite by using the true name for the Fcc directory
path, otherwise a value for `notmuch-database-path' which includes
symbolic links causes test suite failures.
Re-work the declaration and definition of `notmuch-fcc-dirs'. The
variable now allows three types of values:
- nil: no Fcc header is added,
- a string: the value of `notmuch-fcc-dirs' is the name of the
folder to use,
- a list: the folder is chosen based on the From address of the
current message using a list of regular expressions and
corresponding folders:
((\"Sebastian@SSpaeth.de\" . \"privat\")
(\"spaetz@sspaeth.de\" . \"OUTBOX.OSS\")
(\".*\" . \"defaultinbox\"))
If none of the regular expressions match the From address, no
Fcc header will be added.
Call notmuch-fcc-header-setup from message-header-setup-hook rather
than message-send-hook. This allows you to see what's going to
happen, and to make manual adjustments if desired. Gnus does
something similar.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Now that the FCC code is fixed to use the notmuch database path, we can
actually enable this by default, which should be highly useful for all
new users of notmuch.
Otherwise, FCC is too hard to use, (user must set it and also set message-
directory variable to match notmuch mail datbase path). As a rule, I'd like
for users of notmuch to not be required to muck around with non-notmuch
mail settings in emacs.
The above is only really possible now thanks to the recent addition of the
"notmuch config get" command which allows emacs to query the currently
configured notmuch database path.
This also now allows an absolute-path FCC to be set if desired.
In the common case that a user only has one FCC (save outgoing mail in
the Mail directory, it is now possible to simply configure a string
such as "Sent" in the notmuch-fcc-dirs variable. More complex options,
depending on a users email address, are possible and described in the
variable customization help text.
The whole function notmuch-fcc-header-setup has been cleaned up a
little while working on that.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
The fcc code would only initialize if notmuch-fcc-dirs was set. This was
a problem if you reset the variable, or added the variable later during
initialization. Now we always add the fcc hook, but it doesn't do
anything unless notmuch-fcc-dirs are set.
If the user specifies a maildir that does not exist, prompt the user to
see whether a maildir should be created. This will fail, with the
relevant explanation, if the location is not writable, or if a file
already exists in that location. If the location is a dir, but not a
maildir, this will add /tmp/cur/new to it.
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.
Previously this was just a message that was almost impossible for the
user to see. Now, the user gets to see the error message, and is
presented with a buffer that actually contains the Fcc header of
interest.
I have gone wild and added a defcustom "notmuch-fcc-dirs".
Depending on the value of that variable we will not do any
maildir fcc at all (nil, the default), or it is of the format
(("defaultsentbox")
("full name <email@address>" . "Work/sentbox")
("full name2 <email2@address2>" . "Work2/sentbox"))
The outbox name will be concatenated with the message mode
variable "message-directory" which is "~/Mail/" by default.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
1)use insert-buffer-substring
Rather than the insert-buffer. Emacs complains that it is for interactive use
and not for use within elisp. So use insert-buffer-substring which does the
same thing when not handed any 'begin' 'end' parameters.
2)replace caddr with (car (cdr (cdr)))
The former requires 'cl to be loaded and during make install emacs complained
about not knowing it.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Require notmuch-maildir-fcc and also install it.
Rename all jkr/* functions to notmuch-maildir-fcc-*
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>