Re: [PATCH 3/4] emacs: Make tags that appear in `notmuch-show' clickable
authorMark Walters <markwalters1009@gmail.com>
Sun, 18 Nov 2012 23:06:50 +0000 (23:06 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:44 +0000 (09:50 -0800)
ff/4397a3c665ef924d33e7cf7f069614d04001b6 [new file with mode: 0644]

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