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

Aneesh Kumar K.V aneesh.kumar at linux.vnet.ibm.com
Wed Oct 27 10:26:57 PDT 2010


From: Aneesh Kumar K.V <aneesh.kumar at 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 at 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



More information about the notmuch mailing list