emacs: Allow the user to choose the "From" address when composing a new message

When pressing C-u m, the user will be prompted for the identity to use.
This commit is contained in:
Thomas Jost 2011-05-26 10:41:31 +02:00 committed by Carl Worth
parent fda6416745
commit 784649561a
4 changed files with 14 additions and 3 deletions

View file

@ -298,7 +298,7 @@ should be. Returns a cons cell `(tags-per-line width)'."
(define-key map "=" 'notmuch-hello-update) (define-key map "=" 'notmuch-hello-update)
(define-key map "G" 'notmuch-hello-poll-and-update) (define-key map "G" 'notmuch-hello-poll-and-update)
(define-key map (kbd "<C-tab>") 'widget-backward) (define-key map (kbd "<C-tab>") 'widget-backward)
(define-key map "m" 'notmuch-mua-mail) (define-key map "m" 'notmuch-mua-new-mail)
(define-key map "s" 'notmuch-hello-goto-search) (define-key map "s" 'notmuch-hello-goto-search)
map) map)
"Keymap for \"notmuch hello\" buffers.") "Keymap for \"notmuch hello\" buffers.")

View file

@ -161,6 +161,17 @@ name and addresses configured in the notmuch configuration file."
(ido-completing-read "Send mail From: " collection (ido-completing-read "Send mail From: " collection
nil 'confirm nil 'notmuch-mua-sender-history (car collection)))) nil 'confirm nil 'notmuch-mua-sender-history (car collection))))
(defun notmuch-mua-new-mail (&optional prompt-for-sender)
"Invoke the notmuch mail composition window.
If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
the From: address first."
(interactive "P")
(let ((other-headers
(when prompt-for-sender
(list (cons 'from (notmuch-mua-prompt-for-sender))))))
(notmuch-mua-mail nil nil other-headers)))
(defun notmuch-mua-send-and-exit (&optional arg) (defun notmuch-mua-send-and-exit (&optional arg)
(interactive "P") (interactive "P")
(message-send-and-exit arg)) (message-send-and-exit arg))

View file

@ -792,7 +792,7 @@ function is used. "
(define-key map (kbd "<backtab>") 'notmuch-show-previous-button) (define-key map (kbd "<backtab>") 'notmuch-show-previous-button)
(define-key map (kbd "TAB") 'notmuch-show-next-button) (define-key map (kbd "TAB") 'notmuch-show-next-button)
(define-key map "s" 'notmuch-search) (define-key map "s" 'notmuch-search)
(define-key map "m" 'notmuch-mua-mail) (define-key map "m" 'notmuch-mua-new-mail)
(define-key map "f" 'notmuch-show-forward-message) (define-key map "f" 'notmuch-show-forward-message)
(define-key map "r" 'notmuch-show-reply) (define-key map "r" 'notmuch-show-reply)
(define-key map "|" 'notmuch-show-pipe-message) (define-key map "|" 'notmuch-show-pipe-message)

View file

@ -204,7 +204,7 @@ For a mouse binding, return nil."
(define-key map "p" 'notmuch-search-previous-thread) (define-key map "p" 'notmuch-search-previous-thread)
(define-key map "n" 'notmuch-search-next-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)
(define-key map "m" 'notmuch-mua-mail) (define-key map "m" 'notmuch-mua-new-mail)
(define-key map "s" 'notmuch-search) (define-key map "s" 'notmuch-search)
(define-key map "o" 'notmuch-search-toggle-order) (define-key map "o" 'notmuch-search-toggle-order)
(define-key map "c" 'notmuch-search-stash-map) (define-key map "c" 'notmuch-search-stash-map)