unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: Damien Cassou <damien.cassou@gmail.com>,
	notmuch mailing list <notmuch@notmuchmail.org>
Subject: Re: [PATCH 3/4] emacs: Make tags that appear in `notmuch-show' clickable
Date: Sun, 18 Nov 2012 23:06:50 +0000	[thread overview]
Message-ID: <87a9uepl2t.fsf@qmul.ac.uk> (raw)
In-Reply-To: <1353266322-20318-4-git-send-email-damien.cassou@gmail.com>


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 <damien.cassou@gmail.com> wrote:
> Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
> ---
>  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

  reply	other threads:[~2012-11-18 23:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-18 19:18 [PATCH v2] emacs: display tags in notmuch-show with links Damien Cassou
2012-11-18 19:18 ` [PATCH 1/4] Add a thread's tags to emacs header-line Damien Cassou
2012-11-20  5:13   ` Austin Clements
2012-11-20  5:32     ` Austin Clements
2012-11-22 18:36       ` Damien Cassou
2012-11-18 19:18 ` [PATCH 2/4] Make tags in header-line clickable Damien Cassou
2012-11-18 19:18 ` [PATCH 3/4] emacs: Make tags that appear in `notmuch-show' clickable Damien Cassou
2012-11-18 23:06   ` Mark Walters [this message]
2012-11-22 18:40     ` Damien Cassou
2012-11-22 18:46       ` Mark Walters
2012-11-23  8:02       ` Bernard Hurley
2012-11-23 11:18         ` Tomi Ollila
2012-11-30 16:15         ` Damien Cassou
2012-11-20  5:32   ` Austin Clements
2012-11-30 16:13     ` Damien Cassou
2012-11-18 19:18 ` [PATCH 4/4] emacs: Add unit-tests for clickable tags in notmuch-show Damien Cassou
2012-11-18 22:59 ` [PATCH v2] emacs: display tags in notmuch-show with links Ethan Glasser-Camp
2012-11-19  0:10   ` Aaron Ecay
2012-11-20  4:23   ` Austin Clements
2012-11-20  4:50     ` Ethan
2012-11-22 18:11   ` Damien Cassou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a9uepl2t.fsf@qmul.ac.uk \
    --to=markwalters1009@gmail.com \
    --cc=damien.cassou@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).