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 76005431FD0 for ; Thu, 26 May 2011 01:41:56 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] autolearn=disabled 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 K0SfGm3T4oAF for ; Thu, 26 May 2011 01:41:54 -0700 (PDT) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id 29325429E2C for ; Thu, 26 May 2011 01:41:53 -0700 (PDT) Received: from localhost.localdomain (thor.loria.fr [152.81.12.250]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id 6B34B6A06AF; Thu, 26 May 2011 10:41:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1306399312; bh=Za9Q0Kcb+SNmSHdeZ7iBYbwo+6GcTypajYkP0eFgITw=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=FpB2aRQFr5fW1TM3PnKboR4xGPZd9odruRdqLQYx0zFTrtxVuwrRqyjeCmtOyySwD xJ2XKHRDdjrRLm6wyofSUJM7YaRVAgCMTfz45RAhJhfwu+HuW78Ofd+peOAKMio2gu OuoL75HJP+Fn2u84cDveQRJLUWV/LyDbmrpIx55o= From: Thomas Jost To: Carl Worth , Stewart Smith , notmuch Subject: [PATCH v2 4/4] emacs: Allow the user to choose the "From" address when replying to a message Date: Thu, 26 May 2011 10:41:33 +0200 Message-Id: <1306399293-22215-4-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1306399293-22215-1-git-send-email-schnouki@schnouki.net> References: <87hb8hlush.fsf@thor.loria.fr> <1306399293-22215-1-git-send-email-schnouki@schnouki.net> 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: Thu, 26 May 2011 08:41:56 -0000 When pressing C-u r, the user will be prompted for the identity to use. --- emacs/notmuch-mua.el | 13 ++++++++++++- emacs/notmuch-show.el | 6 +++--- emacs/notmuch.el | 6 +++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 1b777d9..f2d86bb 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -69,7 +69,7 @@ list." (push header message-hidden-headers))) notmuch-mua-hidden-headers)) -(defun notmuch-mua-reply (query-string) +(defun notmuch-mua-reply (query-string &optional sender) (let (headers body (args '("reply"))) @@ -90,6 +90,9 @@ list." (setq headers (mail-header-extract))))) (forward-line 1) (setq body (buffer-substring (point) (point-max)))) + ;; If sender is non-nil, set the From: header to its value. + (when sender + (mail-header-set 'from sender headers)) (let ;; Overlay the composition window on that being used to read ;; the original message. @@ -191,6 +194,14 @@ the From: address first." (notmuch-mua-forward-message)) (notmuch-mua-forward-message))) +(defun notmuch-mua-new-reply (query-string &optional prompt-for-sender) + "Invoke the notmuch reply window." + (interactive "P") + (let ((sender + (when prompt-for-sender + (notmuch-mua-prompt-for-sender)))) + (notmuch-mua-reply query-string sender))) + (defun notmuch-mua-send-and-exit (&optional arg) (interactive "P") (message-send-and-exit arg)) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 7e493e9..1c5dfd7 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1153,10 +1153,10 @@ any effects from previous calls to ;; Move to the previous message. (notmuch-show-previous-message))))) -(defun notmuch-show-reply () +(defun notmuch-show-reply (&optional prompt-for-sender) "Reply to the current message." - (interactive) - (notmuch-mua-reply (notmuch-show-get-message-id))) + (interactive "P") + (notmuch-mua-new-reply (notmuch-show-get-message-id) prompt-for-sender)) (defun notmuch-show-forward-message (&optional prompt-for-sender) "Forward the current message." diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 21e0314..3d984bc 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -442,11 +442,11 @@ Complete list of currently available key bindings: crypto-switch) (error "End of search results")))) -(defun notmuch-search-reply-to-thread () +(defun notmuch-search-reply-to-thread (&optional prompt-for-sender) "Begin composing a reply to the entire current thread in a new buffer." - (interactive) + (interactive "P") (let ((message-id (notmuch-search-find-thread-id))) - (notmuch-mua-reply message-id))) + (notmuch-mua-new-reply message-id prompt-for-sender))) (defun notmuch-call-notmuch-process (&rest args) "Synchronously invoke \"notmuch\" with the given list of arguments. -- 1.7.5.1