From: Mark Walters Date: Thu, 22 Aug 2013 17:10:26 +0000 (+0100) Subject: contrib: pick: use close-message-pane for reply etc X-Git-Tag: 0.17_rc1~179 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=e3c2be3e255f2845f6c6b45da96064e2bba681da contrib: pick: use close-message-pane for reply etc We can save some code duplication by using the new close-message-pane functionality for reply, forward, and new mail. --- diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el index 6e71fef8..37dc161e 100644 --- a/contrib/notmuch-pick/notmuch-pick.el +++ b/contrib/notmuch-pick/notmuch-pick.el @@ -236,6 +236,10 @@ FUNC." (define-key map "e" (notmuch-pick-to-message-pane #'notmuch-pick-button-activate)) ;; bindings from show (or elsewhere) but we close the message pane first. + (define-key map "m" (notmuch-pick-close-message-pane-and #'notmuch-mua-new-mail)) + (define-key map "f" (notmuch-pick-close-message-pane-and #'notmuch-show-forward-message)) + (define-key map "r" (notmuch-pick-close-message-pane-and #'notmuch-show-reply-sender)) + (define-key map "R" (notmuch-pick-close-message-pane-and #'notmuch-show-reply)) (define-key map "V" (notmuch-pick-close-message-pane-and #'notmuch-show-view-raw-message)) (define-key map "?" (notmuch-pick-close-message-pane-and #'notmuch-help)) @@ -246,10 +250,6 @@ FUNC." (define-key map "=" 'notmuch-pick-refresh-view) (define-key map "s" 'notmuch-pick-to-search) (define-key map "z" 'notmuch-pick-to-pick) - (define-key map "m" 'notmuch-pick-new-mail) - (define-key map "f" 'notmuch-pick-forward-message) - (define-key map "r" 'notmuch-pick-reply-sender) - (define-key map "R" 'notmuch-pick-reply) (define-key map "n" 'notmuch-pick-next-matching-message) (define-key map "p" 'notmuch-pick-prev-matching-message) (define-key map "N" 'notmuch-pick-next-message) @@ -599,41 +599,6 @@ message will be \"unarchived\", i.e. the tag changes in target (get-buffer buffer-name)))) -(defmacro with-current-notmuch-pick-message (&rest body) - "Evaluate body with current buffer set to the text of current message" - `(save-excursion - (let ((id (notmuch-pick-get-message-id))) - (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*")))) - (with-current-buffer buf - (call-process notmuch-command nil t nil "show" "--format=raw" id) - ,@body) - (kill-buffer buf))))) - -(defun notmuch-pick-new-mail (&optional prompt-for-sender) - "Compose new mail." - (interactive "P") - (notmuch-pick-close-message-window) - (notmuch-mua-new-mail prompt-for-sender )) - -(defun notmuch-pick-forward-message (&optional prompt-for-sender) - "Forward the current message." - (interactive "P") - (notmuch-pick-close-message-window) - (with-current-notmuch-pick-message - (notmuch-mua-new-forward-message prompt-for-sender))) - -(defun notmuch-pick-reply (&optional prompt-for-sender) - "Reply to the sender and all recipients of the current message." - (interactive "P") - (notmuch-pick-close-message-window) - (notmuch-mua-new-reply (notmuch-pick-get-message-id) prompt-for-sender t)) - -(defun notmuch-pick-reply-sender (&optional prompt-for-sender) - "Reply to the sender of the current message." - (interactive "P") - (notmuch-pick-close-message-window) - (notmuch-mua-new-reply (notmuch-pick-get-message-id) prompt-for-sender nil)) - (defun notmuch-pick-clean-address (address) "Try to clean a single email ADDRESS for display. Return AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return