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 68B5C421198 for ; Mon, 23 Jan 2012 02:33:12 -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 DB2LxKdKC19b for ; Mon, 23 Jan 2012 02:33:11 -0800 (PST) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 87FF0429E54 for ; Mon, 23 Jan 2012 02:33:11 -0800 (PST) Received: by wibhi8 with SMTP id hi8so489155wib.26 for ; Mon, 23 Jan 2012 02:33:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.92.101 with SMTP id cl5mr12179219wib.21.1327314790449; Mon, 23 Jan 2012 02:33:10 -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 dr5sm39705841wib.0.2012.01.23.02.33.08 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jan 2012 02:33:08 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id AC787A0950; Mon, 23 Jan 2012 10:33:06 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH 1/3 v2] emacs: Don't return the button from `notmuch-show-insert-part-header'. Date: Mon, 23 Jan 2012 10:33:02 +0000 Message-Id: <1327314784-22555-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.8.3 In-Reply-To: References: X-Gm-Message-State: ALoCoQn36l3v5NpW85JkBvovLi6eUNRmM/oE5/mc/NMH2wGGnzuQXC3BXM6d6sI7jfVl3FFACjtZ 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, 23 Jan 2012 10:33:12 -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. --- Removed the merge of multipart/signed and multipart/encrypted. emacs/notmuch-show.el | 84 +++++++++++++++++++++++++----------------------- 1 files changed, 44 insertions(+), 40 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 03c1f6b..9144484 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -285,24 +285,23 @@ message at DEPTH in the current thread." 'follow-link t 'face 'message-mml) -(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)) - (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 + button-parameters) + (insert "\n")) ;; Functions handling particular MIME parts. @@ -460,15 +459,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))) @@ -482,19 +484,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