aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorThomas Jost <schnouki@schnouki.net>2011-05-26 10:41:33 +0200
committerCarl Worth <cworth@cworth.org>2011-05-26 10:38:16 -0700
commitf7cc259c10cc1a1c85b48d6c826c5e9effb3e34a (patch)
tree01315ac208b34312b6b5cd7c93238a3c81745031 /emacs
parent1a8aae6fa7be108819fa848df3dc98e1840f5eba (diff)
emacs: Allow the user to choose the "From" address when replying to a message
When pressing C-u r, the user will be prompted for the identity to use.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-mua.el13
-rw-r--r--emacs/notmuch-show.el6
-rw-r--r--emacs/notmuch.el6
3 files changed, 18 insertions, 7 deletions
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 7b0aa31..6575af6 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)
;; This make assumptions about the output of `notmuch reply', but
;; really only that the headers come first followed by a blank
@@ -85,6 +85,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.
@@ -186,6 +189,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 add273c..2ba151e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1098,10 +1098,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 c3ed0cd..c22add7 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -436,11 +436,11 @@ Complete list of currently available key bindings:
32 nil nil t)))
(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.