Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 29C56431E62 for ; Wed, 21 Aug 2013 13:23:49 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 bZjkjPjtBIHg for ; Wed, 21 Aug 2013 13:23:39 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 8493A431FC2 for ; Wed, 21 Aug 2013 13:23:39 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 97AAE100086; Wed, 21 Aug 2013 23:23:33 +0300 (EEST) From: Tomi Ollila To: Mark Walters , notmuch@notmuchmail.org Subject: Re: [PATCH v2 11/11] contrib: pick: use close-message-pane for reply etc In-Reply-To: <1376828079-21455-12-git-send-email-markwalters1009@gmail.com> References: <1376828079-21455-1-git-send-email-markwalters1009@gmail.com> <1376828079-21455-12-git-send-email-markwalters1009@gmail.com> User-Agent: Notmuch/0.16+3~g340c058 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain 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, 21 Aug 2013 20:23:49 -0000 On Sun, Aug 18 2013, Mark Walters wrote: > 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 )) This patch series generally LGTM. The only question I have left is how much it matters that e.g. the pick keybinding for new mail cannot use prefix argument to make notmuch-mua-new-mail to prompt-for-sender. Also, how is it made possible that with-current-notmuch-pick-message is not needed anymore ? Maybe, if there is problem with this prompt-for-sender, a followup patch could create another function like `notmuch-pick-close-message-pane-and` which does `(lambda (&optional arg)... and (interactive "P"). and use that in some keybindings. Tomi > - > -(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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch