[PATCH 3/3] notmuch: Add support for listing the parent message

Subject: [PATCH 3/3] notmuch: Add support for listing the parent message

Date: Wed, 27 Oct 2010 22:56:57 +0530

To: cworth@cworth.org

Cc: Aneesh Kumar K.V, notmuch@notmuchmail.org

From: Aneesh Kumar K.V


From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>

When you have long thread, it would be nice to be able to
show the message to which the current message is a reply

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
---
 emacs/notmuch-show.el |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 3fc3787..139c44d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -582,6 +582,7 @@ function is used. "
 	(define-key map " " 'notmuch-show-advance-and-archive)
 	(define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
 	(define-key map (kbd "RET") 'notmuch-show-toggle-message)
+	(define-key map "A" 'notmuch-show-search-parent)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
@@ -1095,4 +1096,15 @@ buffer."
 
 ;;
 
+(defun notmuch-show-get-parent ()
+  (let ((id (notmuch-show-get-header :In-Reply-To)))
+    (if (string-match "^<\\(.*\\)>$" id)
+	(match-string 1 id)
+      id)))
+
+(defun notmuch-show-search-parent ()
+  "Search parent message"
+  (interactive)
+  (notmuch-search (concat "id:\"" (notmuch-show-get-parent) "\"")))
+
 (provide 'notmuch-show)
-- 
1.7.1


Thread: