From: david@tethera.net
To: notmuch@notmuchmail.org
Cc: David Bremner <bremner@unb.ca>
Subject: [PATCH v2] Add functions notmuch-show-get-(bcc, cc, date, from, subject, to).
Date: Thu, 11 Feb 2010 22:44:10 -0400 [thread overview]
Message-ID: <1265942650-30781-1-git-send-email-david@tethera.net> (raw)
In-Reply-To: <id:1265942072-30247-3-git-send-email-david@tethera.net>
From: David Bremner <bremner@unb.ca>
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
next parent reply other threads:[~2010-02-12 2:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <id:1265942072-30247-3-git-send-email-david@tethera.net>
2010-02-12 2:44 ` david [this message]
2010-02-20 20:19 ` [PATCH v2] Add functions notmuch-show-get-(bcc, cc, date, from, subject, to) Carl Worth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1265942650-30781-1-git-send-email-david@tethera.net \
--to=david@tethera.net \
--cc=bremner@unb.ca \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).