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 AB9AC431FDB for ; Sun, 18 Aug 2013 05:15:47 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 yzfyqp8iz9S6 for ; Sun, 18 Aug 2013 05:15:43 -0700 (PDT) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id BFD44431FD2 for ; Sun, 18 Aug 2013 05:15:04 -0700 (PDT) Received: by mail-wi0-f173.google.com with SMTP id en1so2205685wid.0 for ; Sun, 18 Aug 2013 05:15:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eQM61RPlpLPmhcPwhimCL8lYgyUQdz8zvy0f6tasc50=; b=kimyMQ+h34tJ+U/vpNtGLVfDcbPJ+oD1wEJYsUkqsJ2UVyt0gY8JpE98LmjHwPKMDp vDkVwDlF/C0FMIdsj7n6LsD4969rFvOplWTMKH63oa9P26KCvpKMm2Cz0jIIM8Ev4VFd 4hXUmEe6Hgss3QDUyvZ48DHaceTTtENVmrv+C6/5GukXPQwvnkStC5dH9re/omyD9MXb zxVihaJbKulqBhn/dg7xg+4mbCj6if2mEzdDTUu0ZHGj0QmJ/fbiOGWyQwgvnfhdo3AF 93Xcs4xIzLKO8RjXiXoQ4clhyHN2nO0PmyMm6BvS562ozcc7a9lGLaxLNTxcnBQa2wfN R6gA== X-Received: by 10.180.74.134 with SMTP id t6mr4486418wiv.56.1376828103644; Sun, 18 Aug 2013 05:15:03 -0700 (PDT) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id jf2sm9084554wic.2.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 18 Aug 2013 05:15:03 -0700 (PDT) From: Mark Walters 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 Message-Id: <1376828079-21455-12-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1376828079-21455-1-git-send-email-markwalters1009@gmail.com> References: <1376828079-21455-1-git-send-email-markwalters1009@gmail.com> 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: Sun, 18 Aug 2013 12:15:47 -0000 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