From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B82C5429E28 for ; Wed, 25 May 2011 06:23:05 -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 AIHT3ClrirSe for ; Wed, 25 May 2011 06:23:04 -0700 (PDT) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id 5F911429E29 for ; Wed, 25 May 2011 06:23:03 -0700 (PDT) Received: from localhost.localdomain (thor.loria.fr [152.81.12.250]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id BD6C36A06AF; Wed, 25 May 2011 15:23:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1306329782; bh=GvD3UjAiris4Il/Wxoiey3UHK+hu+1BsJjDYkWhJmTs=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=EByUc+L55dh7rDmHZ+leZsxjKTFGsGx7BbwLtHyyexWvQ/YV1/2v98ccM73bkNeEL 7mBNDSk+2MfyKLJ/ZQxAJ7aIcGT8+1UhABQbpttJKk8fr1D2Y3dz/10EM9bilckcay UuHWgE6OvvH6p1v60pWQH8Mw5PT9SHDwtape/uS0= From: Thomas Jost To: notmuch@notmuchmail.org Subject: [PATCH 4/4] emacs: Allow the user to choose the "From" address when replying to a message. Date: Wed, 25 May 2011 15:22:40 +0200 Message-Id: <1306329760-16665-4-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1306329760-16665-1-git-send-email-schnouki@schnouki.net> References: <87lixu7w71.fsf@thor.loria.fr> <1306329760-16665-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: Wed, 25 May 2011 13:23:06 -0000 --- emacs/notmuch-mua.el | 9 ++++++++- emacs/notmuch-show.el | 6 ++++++ emacs/notmuch.el | 7 +++++++ 3 files changed, 21 insertions(+), 1 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 7c08a6e..d04e69c 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. @@ -190,6 +193,10 @@ name and addresses configured in the notmuch configuration file." (user-mail-address (cadr address-components))) (notmuch-mua-forward-message))) +(defun notmuch-mua-reply-prompt-for-sender (query-string) + (interactive) + (notmuch-mua-reply query-string (notmuch-mua-prompt-for-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 50b20b2..2c69e96 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -852,6 +852,7 @@ function is used. " (define-key map "f" 'notmuch-show-forward-message) (define-key map "F" 'notmuch-show-forward-message-prompt-for-sender) (define-key map "r" 'notmuch-show-reply) + (define-key map "R" 'notmuch-show-reply-prompt-for-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) @@ -1160,6 +1161,11 @@ any effects from previous calls to (interactive) (notmuch-mua-reply (notmuch-show-get-message-id))) +(defun notmuch-show-reply-prompt-for-sender () + "Reply to the current message, prompting for the From: address first." + (interactive) + (notmuch-mua-reply-prompt-for-sender (notmuch-show-get-message-id))) + (defun notmuch-show-forward-message () "Forward the current message." (interactive) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 1791d84..153dc74 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -204,6 +204,7 @@ For a mouse binding, return nil." (define-key map "p" 'notmuch-search-previous-thread) (define-key map "n" 'notmuch-search-next-thread) (define-key map "r" 'notmuch-search-reply-to-thread) + (define-key map "R" 'notmuch-search-reply-to-thread-prompt-for-sender) (define-key map "m" 'notmuch-mua-new-mail) (define-key map "M" 'notmuch-mua-new-mail-prompt-for-sender) (define-key map "s" 'notmuch-search) @@ -449,6 +450,12 @@ Complete list of currently available key bindings: (let ((message-id (notmuch-search-find-thread-id))) (notmuch-mua-reply message-id))) +(defun notmuch-search-reply-to-thread-prompt-for-sender () + "Begin composing a reply to the entire current thread in a new buffer, prompting for the From: address first." + (interactive) + (let ((message-id (notmuch-search-find-thread-id))) + (notmuch-mua-reply-prompt-for-sender message-id))) + (defun notmuch-call-notmuch-process (&rest args) "Synchronously invoke \"notmuch\" with the given list of arguments. -- 1.7.5.1