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 AFFEA431FBD for ; Sun, 18 Nov 2012 15:06:59 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 zUsH8BZwJp4S for ; Sun, 18 Nov 2012 15:06:57 -0800 (PST) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 78375431FB6 for ; Sun, 18 Nov 2012 15:06:57 -0800 (PST) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1TaDwx-0007TB-L3; Sun, 18 Nov 2012 23:06:54 +0000 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1TaDwx-0001u1-81; Sun, 18 Nov 2012 23:06:51 +0000 From: Mark Walters To: Damien Cassou , notmuch mailing list Subject: Re: [PATCH 3/4] emacs: Make tags that appear in `notmuch-show' clickable In-Reply-To: <1353266322-20318-4-git-send-email-damien.cassou@gmail.com> References: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com> <1353266322-20318-4-git-send-email-damien.cassou@gmail.com> User-Agent: Notmuch/0.14+81~g9730584 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Sun, 18 Nov 2012 23:06:50 +0000 Message-ID: <87a9uepl2t.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 93.97.24.31 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: 446cb36ac7d91dd2b6fb86fc36d53131 (of first 20000 bytes) X-SpamAssassin-Score: -1.8 X-SpamAssassin-SpamBar: - X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored -1.8 points. Summary of the scoring: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, * medium trust * [138.37.6.40 listed in list.dnswl.org] * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * 0.5 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean 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 Nov 2012 23:06:59 -0000 Hi This patch adds buttons for every tag in show mode which means that tabbing down to an attachment (or other button) is rather slower. As someone who is not going to use the tag buttons (at least not very often) Is it possible to avoid this? perhaps by making the button optional or making the button only mouse clickable? (Since the buttons in the headerline are not tabbable to then the latter might be reasonable.) Best wishes Mark On Sun, 18 Nov 2012, Damien Cassou wrote: > Signed-off-by: Damien Cassou > --- > emacs/notmuch-show.el | 9 +++++---- > emacs/notmuch-tagger.el | 33 +++++++++++++++++++++++++++++++++ > 2 files changed, 38 insertions(+), 4 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 988e27c..379c8cd 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -431,10 +431,11 @@ message at DEPTH in the current thread." > (notmuch-show-clean-address (plist-get headers :From)) > " (" > date > - ") (" > - (propertize (mapconcat 'identity tags " ") > - 'face 'notmuch-tag-face) > - ")\n") > + ") " > + (propertize > + (format-mode-line (notmuch-tagger-present-tags tags)) > + 'face 'notmuch-tag-face) > + "\n") > (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face))) > > (defun notmuch-show-insert-header (header header-value) > diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el > index 19a6c7e..379a905 100644 > --- a/emacs/notmuch-tagger.el > +++ b/emacs/notmuch-tagger.el > @@ -53,12 +53,21 @@ test if the library is present before calling this function." > (let ((tag (header-button-get button 'notmuch-tagger-tag))) > (notmuch-tagger-goto-target tag))) > > +(defun notmuch-tagger-body-button-action (button) > + "Open `notmuch-search' for the tag referenced by BUTTON." > + (let ((tag (button-get button 'notmuch-tagger-tag))) > + (notmuch-tagger-goto-target tag))) > + > (eval-after-load "header-button" > '(define-button-type 'notmuch-tagger-header-button-type > 'supertype 'header > 'action #'notmuch-tagger-header-button-action > 'follow-link t)) > > +(define-button-type 'notmuch-tagger-body-button-type > + 'action #'notmuch-tagger-body-button-action > + 'follow-link t) > + > (defun notmuch-tagger-really-make-header-link (tag) > "Return a property list that presents a link to TAG. > > @@ -82,6 +91,19 @@ if not." > (notmuch-tagger-really-make-header-link tag) > tag)) > > +(defun notmuch-tagger-make-body-link (tag) > + "Return a property list that presents a link to TAG. > +The returned property list will work everywhere except in the > +header-line. For a link that works on the header-line, prefer > +`notmuch-tagger-make-header-link'." > + (let ((button (copy-sequence tag))) > + (make-text-button > + button nil > + 'type 'notmuch-tagger-body-button-type > + 'notmuch-tagger-tag tag > + 'help-echo (format "%s: Search other messages like this" tag)) > + button)) > + > (defun notmuch-tagger-present-tags-header-line (tags) > "Return a property list to present TAGS in emacs header-line." > (list > @@ -91,6 +113,17 @@ if not." > " ") > ")")) > > +(defun notmuch-tagger-present-tags (tags) > + "Return a property list to present TAGS in emacs. > +If tags the result of this function is to be used within the > +header-line, prefer `notmuch-tagger-present-tags-header-line' > +instead of this function." > + (list > + "(" > + (notmuch-tagger-separate-elems > + (mapcar #'notmuch-tagger-make-body-link tags) > + " ") > + ")")) > > (provide 'notmuch-tagger) > ;;; notmuch-tagger.el ends here > -- > 1.7.10.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch