Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2679B431FCF for ; Mon, 1 Mar 2010 09:30:16 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.208 X-Spam-Level: X-Spam-Status: No, score=-2.208 tagged_above=-999 required=5 tests=[AWL=0.391, BAYES_00=-2.599] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 967qO3jgcEDf for ; Mon, 1 Mar 2010 09:30:15 -0800 (PST) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 4099D431FBD for ; Mon, 1 Mar 2010 09:30:15 -0800 (PST) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 180A419F33C7; Mon, 1 Mar 2010 18:30:07 +0100 (CET) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id 7SvD9VbASmzK; Mon, 1 Mar 2010 18:30:04 +0100 (CET) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id DB8ED19F33C9; Mon, 1 Mar 2010 18:30:04 +0100 (CET) Received: from localhost.localdomain (k335-30.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id D1047FA004; Mon, 1 Mar 2010 18:30:04 +0100 (CET) From: Michal Sojka To: notmuch@notmuchmail.org Date: Mon, 1 Mar 2010 18:29:48 +0100 Message-Id: <1267464588-21050-2-git-send-email-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1267464588-21050-1-git-send-email-sojkam1@fel.cvut.cz> References: <1267464588-21050-1-git-send-email-sojkam1@fel.cvut.cz> Subject: [notmuch] [PATCH 2/2] Emacs code for replying only to sender (bound to 'R' key) X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2010 17:30:16 -0000 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 --- 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