[notmuch] [PATCH 2/2] Emacs code for replying only to sender (bound to 'R' key)

Michal Sojka sojkam1 at fel.cvut.cz
Mon Mar 1 09:29:48 PST 2010


This is probably a very stupid implementation. I do not know elisp
well, so I appreciate advises on how to avoid code duplication.

Signed-off-by: Michal Sojka <sojkam1 at fel.cvut.cz>
---
 notmuch.el |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 6482170..fb567f2 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -79,6 +79,7 @@
     (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-to-sender)
     (define-key map "|" 'notmuch-show-pipe-message)
     (define-key map "w" 'notmuch-show-save-attachments)
     (define-key map "V" 'notmuch-show-view-raw-message)
@@ -479,6 +480,23 @@ buffer."
   (let ((message-id (notmuch-show-get-message-id)))
     (notmuch-reply message-id)))
 
+(defun notmuch-reply-to-sender (query-string)
+  (switch-to-buffer (generate-new-buffer "notmuch-draft"))
+  (call-process notmuch-command nil t nil "reply" "--sender-only" 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-to-sender ()
+  "Begin composing a reply to the sender of the current message in a new buffer."
+  (interactive)
+  (let ((message-id (notmuch-show-get-message-id)))
+    (notmuch-reply-to-sender message-id)))
+
 (defun notmuch-show-forward-current ()
   "Forward the current message."
   (interactive)
-- 
1.7.0



More information about the notmuch mailing list