Patchworkβ [-V3,2/2] notmuch.el: Add support for reply-to sender

login
register
about
Submitter Aneesh Kumar K.V
Date 2010-03-10 16:31:26
Message ID <1268238686-13605-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/417/
State New
Headers show

Comments

Aneesh Kumar K.V - 2010-03-10 16:31:26
From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>

Add key binding to do a reply-to sender. This is mapped to 'R'

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

Patch

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5b553bb..9ba1ec1 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -78,7 +78,8 @@ 
     (define-key map "s" 'notmuch-search)
     (define-key map "m" 'message-mail)
     (define-key map "f" 'notmuch-show-forward-current)
-    (define-key map "r" 'notmuch-show-reply)
+    (define-key map "r" 'notmuch-show-reply-all)
+    (define-key map "R" 'notmuch-show-reply)
     (define-key map "|" 'notmuch-show-pipe-message)
     (define-key map "w" 'notmuch-show-save-attachments)
     (define-key map "V" 'notmuch-show-view-raw-message)
@@ -446,12 +447,31 @@  buffer."
 	(forward-line)))
   (message-mode))
 
-(defun notmuch-show-reply ()
+(defun notmuch-show-reply-all ()
   "Begin composing a reply to the current message in a new buffer."
   (interactive)
   (let ((message-id (notmuch-show-get-message-id)))
     (notmuch-reply message-id)))
 
+
+(defun notmuch-recipient-reply (recipient query-string)
+  (switch-to-buffer (generate-new-buffer "notmuch-draft"))
+  (call-process notmuch-command nil t nil "reply"
+		(concat "--recipient=" recipient) query-string)
+  (message-insert-signature)
+  (goto-char (point-min))
+  (if (re-search-forward "^$" nil t)
+      (progn
+	(insert "--text follows this line--")
+	(forward-line)))
+  (message-mode))
+
+(defun notmuch-show-reply ()
+  "Begin composing a reply to the current message in a new buffer."
+  (interactive)
+  (let ((message-id (notmuch-show-get-message-id)))
+    (notmuch-recipient-reply "sender" message-id)))
+
 (defun notmuch-show-forward-current ()
   "Forward the current message."
   (interactive)