unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 11/11] contrib: pick: use close-message-pane for reply etc
Date: Sun, 18 Aug 2013 13:14:39 +0100	[thread overview]
Message-ID: <1376828079-21455-12-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1376828079-21455-1-git-send-email-markwalters1009@gmail.com>

We can save some code duplication by using the new close-message-pane
functionality for reply, forward, and new mail.
---
 contrib/notmuch-pick/notmuch-pick.el |   43 +++------------------------------
 1 files changed, 4 insertions(+), 39 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 0e10c7c..3b86a5a 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
-- 
1.7.9.1

  parent reply	other threads:[~2013-08-18 12:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
2013-08-18 12:14 ` [PATCH v2 01/11] contrib: pick: override notmuch-show-get-prop Mark Walters
2013-08-18 12:14 ` [PATCH v2 02/11] contrib: pick: Link in notmuch-show-pipe-message Mark Walters
2013-08-18 12:14 ` [PATCH v2 03/11] contrib: pick: Link in attachment functions straight from notmuch-show Mark Walters
2013-08-18 12:14 ` [PATCH v2 04/11] contrib: pick: Link in stash map " Mark Walters
2013-08-18 12:14 ` [PATCH v2 05/11] contrib: pick: add in to-message-window function Mark Walters
2013-08-18 12:14 ` [PATCH v2 06/11] contrib: pick: add button press helper Mark Walters
2013-08-18 12:14 ` [PATCH v2 07/11] contrib: pick: pass tab through to the message pane Mark Walters
2013-08-18 12:14 ` [PATCH v2 08/11] contrib: pick: close window function Mark Walters
2013-08-18 12:14 ` [PATCH v2 09/11] contrib: pick: make help close the message pane first Mark Walters
2013-08-18 12:14 ` [PATCH v2 10/11] contrib: pick: add in binding to view raw message Mark Walters
2013-08-18 12:14 ` Mark Walters [this message]
2013-08-21 20:23   ` [PATCH v2 11/11] contrib: pick: use close-message-pane for reply etc Tomi Ollila

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376828079-21455-12-git-send-email-markwalters1009@gmail.com \
    --to=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).