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 4923B431FAF for ; Mon, 10 Dec 2012 16:22:34 -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 yypQy473oR6L for ; Mon, 10 Dec 2012 16:22:33 -0800 (PST) Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU [18.9.25.13]) by olra.theworths.org (Postfix) with ESMTP id 429B3431FAE for ; Mon, 10 Dec 2012 16:22:33 -0800 (PST) X-AuditID: 1209190d-b7f266d00000092b-60-50c67cc8566b Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id D5.40.02347.8CC76C05; Mon, 10 Dec 2012 19:22:32 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qBB0MPlZ005906; Mon, 10 Dec 2012 19:22:27 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qBB0MMUX017091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 10 Dec 2012 19:22:24 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1TiDc6-0002XE-JO; Mon, 10 Dec 2012 19:22:22 -0500 From: Austin Clements To: Mark Walters , notmuch@notmuchmail.org Subject: Re: [PATCH 1/3] emacs: show: modify insert-part-header to save the button text In-Reply-To: <1354663662-20524-2-git-send-email-markwalters1009@gmail.com> References: <1354663662-20524-1-git-send-email-markwalters1009@gmail.com> <1354663662-20524-2-git-send-email-markwalters1009@gmail.com> User-Agent: Notmuch/0.14+159~g6895fee (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Mon, 10 Dec 2012 19:22:22 -0500 Message-ID: <87wqwpo2td.fsf@awakening.csail.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDIsWRmVeSWpSXmKPExsUixG6nrnui5liAwZJ2aYvVc3ksrt+cyezA 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZfxabV2wX6Di4AaTBsYrPF2MHBwSAiYSq64L dDFyApliEhfurWfrYuTiEBLYxygxa+1WRghnA6PEx/cv2UGqhAQuMkn8uC4EkVjCKLGk8zYz SIJNQF9ixdpJrCC2iICrxNNvn5lBNggLhEtcfh4AEuYU8JLYe3sN1NB2Rok/W08wgdSICsRL zD7nA1LDIqAqsfz2IRYQmxfouGNvOtggbEGJkzOfgMWZBbQkbvx7yTSBUWAWktQsJKkFjEyr GGVTcqt0cxMzc4pTk3WLkxPz8lKLdI30cjNL9FJTSjcxggKRU5J3B+O7g0qHGAU4GJV4eCtU jwUIsSaWFVfmHmKU5GBSEuU9XQUU4kvKT6nMSCzOiC8qzUktPsQowcGsJMJbmguU401JrKxK LcqHSUlzsCiJ815JuekvJJCeWJKanZpakFoEk5Xh4FCS4A2uBmoULEpNT61Iy8wpQUgzcXCC DOcBGs5QAzK8uCAxtzgzHSJ/ilFRSpz3BkizAEgiozQPrheWKF4xigO9Isx7FaSKB5hk4Lpf AQ1mAhp8UvAwyOCSRISUVAPj+goVS2nhXNO584903LLR3vU5c8Pqk8tbmULj9Tqmm//qFuxx WNJ31O1HWgbXtcMhn2//O8P1IWpnpcHGezOamV34hHIKQ+7UayxLc7/XbjyreumkoG0Cj+z/ n/49v35JVNSiY6qX+9zLHb+tuajpwnZE9SVv5KqUn6V96jHOnJMn1jiuLG1QYinOSDTUYi4q TgQAAReb9+8CAAA= 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: Tue, 11 Dec 2012 00:22:34 -0000 On Tue, 04 Dec 2012, Mark Walters wrote: > This just make notmuch-show-insert-part-header save the basic button > text for parts as an attribute. This makes it simpler for the button > action (added in a later patch) to reword the label as appropriate (eg > append "(not shown)" or not as appropriate). > --- > emacs/notmuch-show.el | 19 ++++++++++--------- > 1 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index d7fa10e..f8ce037 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -483,17 +483,18 @@ message at DEPTH in the current thread." > (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)) > + (let ((button) > + (base-label (concat (if name (concat name ": ") "") > + declared-type > + (if (not (string-equal declared-type content-type)) > + (concat " (as " content-type ")") > + "") > + (or comment "")))) > + This patch is obviously fine, but if you don't mind some drive-by cleanup, this could be made simpler by taking advantage of how concat omits nils: (concat (when name (concat name ": ")) declared-type (unless (string-equal declared-type content-type) (concat " (as " content-type ")")) comment) > (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 "") > - " ]") > + (concat "[ " base-label " ]") > + :base-label base-label > :type 'notmuch-show-part-button-type > :notmuch-part nth > :notmuch-filename name > -- > 1.7.9.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch