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 ADF42431FAF for ; Mon, 6 Feb 2012 07:39:20 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[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 oUr2KLlSCWql for ; Mon, 6 Feb 2012 07:39:18 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 98C20431FBD for ; Mon, 6 Feb 2012 07:39:16 -0800 (PST) Received: by werb10 with SMTP id b10so5266644wer.26 for ; Mon, 06 Feb 2012 07:39:13 -0800 (PST) Received: by 10.216.135.214 with SMTP id u64mr7012639wei.58.1328542753866; Mon, 06 Feb 2012 07:39:13 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id p10sm26449810wic.0.2012.02.06.07.39.10 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 06 Feb 2012 07:39:11 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 4FA7FA0C40; Mon, 6 Feb 2012 15:39:09 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH v3 1/3] emacs: Don't return the button from `notmuch-show-insert-part-header'. Date: Mon, 6 Feb 2012 15:39:06 +0000 Message-Id: <1328542748-19530-3-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.8.3 In-Reply-To: <1328542748-19530-1-git-send-email-dme@dme.org> References: <1327052612-1040-1-git-send-email-dme@dme.org> <1328542748-19530-1-git-send-email-dme@dme.org> 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: Mon, 06 Feb 2012 15:39:21 -0000 Instead, allow the caller to specify some parameters for the button. Rework `notmuch-show-insert-part-multipart/signed' and `notmuch-show-insert-part-multipart/encrypted' accordingly. --- emacs/notmuch-show.el | 86 +++++++++++++++++++++++++----------------------- 1 files changed, 45 insertions(+), 41 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 7469e2e..079d7cb 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -397,25 +397,24 @@ message at DEPTH in the current thread." "Submap for button commands") (fset 'notmuch-show-part-button-map notmuch-show-part-button-map) -(defun notmuch-show-insert-part-header (nth content-type declared-type &optional name comment) - (let ((button)) - (setq button - (insert-button - (concat "[ " - (if name (concat name ": ") "") - declared-type - (if (not (string-equal declared-type content-type)) - (concat " (as " content-type ")") - "") - (or comment "") - " ]") - :type 'notmuch-show-part-button-type - :notmuch-part nth - :notmuch-filename name - :notmuch-content-type content-type)) - (insert "\n") - ;; return button - button)) +(defun notmuch-show-insert-part-header (nth content-type declared-type + &optional name comment + &rest button-parameters) + (apply #'insert-button + (concat "[ " + (if name (concat name ": ") "") + declared-type + (if (not (string-equal declared-type content-type)) + (concat " (as " content-type ")") + "") + (or comment "") + " ]") + :type 'notmuch-show-part-button-type + :notmuch-part nth + :notmuch-filename name + :notmuch-content-type content-type + button-parameters) + (insert "\n")) ;; Functions handling particular MIME parts. @@ -602,15 +601,18 @@ current buffer, if possible." t) (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth declared-type) - (let ((button (notmuch-show-insert-part-header nth declared-type content-type nil))) - (button-put button 'face 'notmuch-crypto-part-header) - ;; add signature status button if sigstatus provided - (if (plist-member part :sigstatus) - (let* ((from (notmuch-show-get-header :From msg)) - (sigstatus (car (plist-get part :sigstatus)))) - (notmuch-crypto-insert-sigstatus-button sigstatus from)) - ;; if we're not adding sigstatus, tell the user how they can get it - (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts."))) + ;; Add signature status button if sigstatus provided. + (if (plist-member part :sigstatus) + (let ((from (notmuch-show-get-header :From msg)) + (sigstatus (car (plist-get part :sigstatus)))) + (notmuch-show-insert-part-header nth declared-type content-type nil nil + 'face 'notmuch-crypto-part-header) + (notmuch-crypto-insert-sigstatus-button sigstatus from)) + + ;; If we're not adding sigstatus, tell the user how to enable it. + (notmuch-show-insert-part-header nth declared-type content-type nil nil + 'face 'notmuch-crypto-part-header + 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")) (let ((inner-parts (plist-get part :content)) (start (point))) @@ -624,19 +626,21 @@ current buffer, if possible." t) (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth declared-type) - (let ((button (notmuch-show-insert-part-header nth declared-type content-type nil))) - (button-put button 'face 'notmuch-crypto-part-header) - ;; add encryption status button if encstatus specified - (if (plist-member part :encstatus) - (let ((encstatus (car (plist-get part :encstatus)))) - (notmuch-crypto-insert-encstatus-button encstatus) - ;; add signature status button if sigstatus specified - (if (plist-member part :sigstatus) - (let* ((from (notmuch-show-get-header :From msg)) - (sigstatus (car (plist-get part :sigstatus)))) - (notmuch-crypto-insert-sigstatus-button sigstatus from)))) - ;; if we're not adding encstatus, tell the user how they can get it - (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts."))) + ;; Add encryption status button if encstatus provided. + (if (plist-member part :encstatus) + (let ((encstatus (car (plist-get part :encstatus)))) + (notmuch-show-insert-part-header nth declared-type content-type nil nil + 'face 'notmuch-crypto-part-header) + (notmuch-crypto-insert-encstatus-button encstatus) + ;; add signature status button if sigstatus specified + (if (plist-member part :sigstatus) + (let* ((from (notmuch-show-get-header :From msg)) + (sigstatus (car (plist-get part :sigstatus)))) + (notmuch-crypto-insert-sigstatus-button sigstatus from)))) + ;; If we're not adding encstatus, tell the user how to enable it. + (notmuch-show-insert-part-header nth declared-type content-type nil nil + 'face 'notmuch-crypto-part-header + 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")) (let ((inner-parts (plist-get part :content)) (start (point))) -- 1.7.8.3