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 A44CB431FBD for ; Thu, 11 Feb 2010 18:47:06 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.979 X-Spam-Level: X-Spam-Status: No, score=-1.979 tagged_above=-999 required=5 tests=[AWL=0.620, BAYES_00=-2.599] autolearn=ham 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 UT+zXhq5NgdL for ; Thu, 11 Feb 2010 18:47:06 -0800 (PST) Received: from pivot.cs.unb.ca (pivot.cs.unb.ca [131.202.240.57]) by olra.theworths.org (Postfix) with ESMTP id 09934431FAE for ; Thu, 11 Feb 2010 18:47:06 -0800 (PST) Received: from fctnnbsc30w-142167166109.pppoe-dynamic.high-speed.nb.bellaliant.net ([142.167.166.109] helo=rocinante.cs.unb.ca) by pivot.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NflYf-0002Ld-Jb; Thu, 11 Feb 2010 22:47:05 -0400 Received: from bremner by rocinante.cs.unb.ca with local (Exim 4.71) (envelope-from ) id 1NflVy-00081t-Oz; Thu, 11 Feb 2010 22:44:18 -0400 From: david@tethera.net To: notmuch@notmuchmail.org Date: Thu, 11 Feb 2010 22:44:10 -0400 Message-Id: <1265942650-30781-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.6.5 In-Reply-To: References: X-Sender-Verified: bremner@pivot.cs.unb.ca Cc: David Bremner Subject: [notmuch] [PATCH v2] Add functions notmuch-show-get-(bcc, cc, date, from, subject, to). 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: Fri, 12 Feb 2010 02:47:06 -0000 From: David Bremner Return the corresponding header field for the current message as a string. These are thin wrappers around notmuch-show-get-header, which means they each cause a full parse of the RFC822 header. The main idea is to fix an api. --- Sorry, resending with fixed commit message. notmuch.el | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/notmuch.el b/notmuch.el index c96fd94..d2a3b1b 100644 --- a/notmuch.el +++ b/notmuch.el @@ -225,6 +225,38 @@ Unlike builtin `previous-line' this version accepts no arguments." (re-search-forward notmuch-show-tags-regexp) (split-string (buffer-substring (match-beginning 1) (match-end 1))))) +(defun notmuch-show-get-bcc () + "Return To address of current message" + (notmuch-show-get-header-field 'bcc)) + +(defun notmuch-show-get-cc () + "Return To address of current message" + (notmuch-show-get-header-field 'cc)) + +(defun notmuch-show-get-date () + "Return To address of current message" + (notmuch-show-get-header-field 'date)) + +(defun notmuch-show-get-from () + "Return From address of current message" + (notmuch-show-get-header-field 'from)) + +(defun notmuch-show-get-subject () + "Return subject of current message" + (notmuch-show-get-header-field 'subject)) + +(defun notmuch-show-get-to () + "Return To address of current message" + (notmuch-show-get-header-field 'to)) + +(defun notmuch-show-get-header-field (name) + "Retrieve the header field NAME from the current message. +NAME should be a symbol, in lower case, as returned by +mail-header-extract-no-properties" + (let* ((result (assoc name (notmuch-show-get-header))) + (val (and result (cdr result)))) + val)) + (defun notmuch-show-get-header () "Retrieve and parse the header from the current message. Returns an alist with of (header . value) where header is a symbol and value is a string. The summary from notmuch-show is returned as the -- 1.6.5