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 1616A429E20 for ; Mon, 9 May 2011 05:06:24 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 1.7 X-Spam-Level: * X-Spam-Status: No, score=1.7 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=2.499, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled 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 hGjuK42mhZRe for ; Mon, 9 May 2011 05:06:22 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 09229431FB5 for ; Mon, 9 May 2011 05:06:21 -0700 (PDT) Received: by fxm8 with SMTP id 8so3825315fxm.26 for ; Mon, 09 May 2011 05:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=m0TwHfonWSWseCLsAsQP150knKvkxP1Wdo5cned05RI=; b=Hc84PR24ZY42Dx79M8zcl7HxDh8lDQIdcq33VRJ2+iy7TqoyNZffZ8WLWtU+jx+C86 t++3lSLmGcW2TWGfPhbfE+QqfMfEPRVl7kCIsmQG6tbJVABv8pu+99uuKWmc1IXmvGh5 5XhgqCdovOEfqPIAj9wyUJe+s/P9mpTiFqJKY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=dWQMD0DRoAOZvjwaTytkHWHwyuy+32nD9Ja+v1UGYUeSajQfJV2ksRldbVctGg2BtX loBconJJ4olnJxHauhH7z7fkafWDctlPXwPyZKDnoUaCW6um2Cekq58xEOSFfpce9yiE v1imazK8xQgorkV0XGyjH9Yi72QkDz/Vs37wY= Received: by 10.223.113.193 with SMTP id b1mr1998933faq.47.1304942780190; Mon, 09 May 2011 05:06:20 -0700 (PDT) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id o20sm94353fal.1.2011.05.09.05.06.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 May 2011 05:06:19 -0700 (PDT) From: Dmitry Kurochkin To: Notmuch Mail Subject: [PATCH] Use message-field-value instead of message-fetch-field in FCC header setup. Date: Mon, 9 May 2011 16:06:20 +0400 Message-Id: <1304942780-4228-1-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.5.1 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: Mon, 09 May 2011 12:06:24 -0000 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