* [PATCH] Use message-field-value instead of message-fetch-field in FCC header setup.
@ 2011-05-09 12:06 Dmitry Kurochkin
2011-05-09 16:32 ` Jameson Graef Rollins
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Kurochkin @ 2011-05-09 12:06 UTC (permalink / raw)
To: Notmuch Mail
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.
---
The patch is for the release-candidate/0.6 branch. It is an amended
version of a patch I sent a while ago
id:"1278000507-22290-4-git-send-email-dmitry.kurochkin@gmail.com".
Regards,
Dmitry
emacs/notmuch-maildir-fcc.el | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 3f1c124..aede753 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -80,7 +80,7 @@ will NOT be removed or replaced."
(let ((subdir
(cond
((or (not notmuch-fcc-dirs)
- (message-fetch-field "Fcc"))
+ (message-field-value "Fcc"))
;; Nothing set or an existing header.
nil)
@@ -93,7 +93,7 @@ will NOT be removed or replaced."
(error "Invalid `notmuch-fcc-dirs' setting (old style)"))
((listp notmuch-fcc-dirs)
- (let* ((from (message-fetch-field "From"))
+ (let* ((from (message-field-value "From"))
(match
(catch 'first-match
(dolist (re-folder notmuch-fcc-dirs)
@@ -118,7 +118,7 @@ will NOT be removed or replaced."
(concat (notmuch-database-path) "/" subdir)))))
;; finally test if fcc points to a valid maildir
- (let ((fcc-header (message-fetch-field "Fcc")))
+ (let ((fcc-header (message-field-value "Fcc")))
(unless (notmuch-maildir-fcc-dir-is-maildir-p fcc-header)
(cond ((not (file-writable-p fcc-header))
(error (format "No permission to create %s, which does not exist"
--
1.7.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Use message-field-value instead of message-fetch-field in FCC header setup.
2011-05-09 12:06 [PATCH] Use message-field-value instead of message-fetch-field in FCC header setup Dmitry Kurochkin
@ 2011-05-09 16:32 ` Jameson Graef Rollins
0 siblings, 0 replies; 2+ messages in thread
From: Jameson Graef Rollins @ 2011-05-09 16:32 UTC (permalink / raw)
To: Dmitry Kurochkin, Notmuch Mail
[-- Attachment #1: Type: text/plain, Size: 622 bytes --]
On Mon, 9 May 2011 16:06:20 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> 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.
Hey, Dmitry. This is a nice clean fix. I've applied it to the r-c/0.6.
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-09 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-09 12:06 [PATCH] Use message-field-value instead of message-fetch-field in FCC header setup Dmitry Kurochkin
2011-05-09 16:32 ` Jameson Graef Rollins
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).