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@notmuchmail.org
Subject: Re:
Date: Thu, 13 Dec 2012 11:45:57 +0000	[thread overview]
Message-ID: <877gomdvka.fsf@qmul.ac.uk> (raw)
In-Reply-To: <1355216437-21109-1-git-send-email-damien.cassou@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]


Hi

This is looking good: I have two comments the second of which is significant.

The first is do you want to sort (alphabetically) the headerline tags?
As it stands they are in the order they appear in the thread which is
probably not what is wanted.

The second is that there is a notmuch-show-tag-all functions to tag all
messages in the thread. Your patch is quadratic for the update (as it
calculates the list of thread tags once for each message). The attached
patch would avoid this and doesn't look too bad. (Note I retained
no-headerline-update as an optional argument in case there are out of
tree callers, eg users' .emacs files)

[Note this is not purely of academic interest: on my test large thread
(178 messages) updating the display after tagging all messages took some
seconds without my patch and almost no time with it.]

Best wishes 

Mark


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mjw-tweak.patch --]
[-- Type: text/x-diff, Size: 2186 bytes --]

From ab15a4bdb50bcf6b2851806195bbe8bea3b099dc Mon Sep 17 00:00:00 2001
From: Mark Walters <markwalters1009@gmail.com>
Date: Thu, 13 Dec 2012 11:23:09 +0000
Subject: [PATCH] Avoid quadratic update

---
 emacs/notmuch-show.el |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 93bce07..8dd6010 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -356,7 +356,7 @@ operation on the contents of the current buffer."
   "Return a string comprised of `n' spaces."
   (make-string n ? ))
 
-(defun notmuch-show-update-tags (tags)
+(defun notmuch-show-update-tags (tags &optional no-headerline-update)
   "Update the displayed tags of the current message."
   (save-excursion
     (goto-char (notmuch-show-message-top))
@@ -364,7 +364,8 @@ operation on the contents of the current buffer."
 	(let ((inhibit-read-only t))
 	  (replace-match (propertize (notmuch-tagger-format-tags tags)
 				     'face 'notmuch-tag-face)))))
-  (notmuch-show-update-header-line))
+  (unless no-headerline-update
+    (notmuch-show-update-header-line)))
 
 (defun notmuch-clean-address (address)
   "Try to clean a single email ADDRESS for display. Return a cons
@@ -1461,10 +1462,10 @@ current thread."
 (defun notmuch-show-get-depth ()
   (notmuch-show-get-prop :depth))
 
-(defun notmuch-show-set-tags (tags)
+(defun notmuch-show-set-tags (tags &optional no-headerline-update)
   "Set the tags of the current message."
   (notmuch-show-set-prop :tags tags)
-  (notmuch-show-update-tags tags))
+  (notmuch-show-update-tags tags no-headerline-update))
 
 (defun notmuch-show-get-tags ()
   "Return the tags of the current message."
@@ -1778,7 +1779,8 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."
      (let* ((current-tags (notmuch-show-get-tags))
 	    (new-tags (notmuch-update-tags current-tags tag-changes)))
        (unless (equal current-tags new-tags)
-	 (notmuch-show-set-tags new-tags))))))
+	 (notmuch-show-set-tags new-tags t)))))
+  (notmuch-show-update-header-line))
 
 (defun notmuch-show-add-tag ()
   "Same as `notmuch-show-tag' but sets initial input to '+'."
-- 
1.7.9.1


[-- Attachment #3: Type: text/plain, Size: 1489 bytes --]




On Tue, 11 Dec 2012, Damien Cassou <damien.cassou@gmail.com> wrote:
> From: Damien Cassou <damien.cassou@gmail.com>
> Subject: [PATCH v4] emacs: display tags in notmuch-show with links
> In-Reply-To: 
>
> This patch obsoletes:
> id:1355149964-27905-1-git-send-email-damien.cassou@gmail.com
>
> [PATCH 1/4] emacs: Add a thread's tags to notmuch-show header-line
> [PATCH 2/4] emacs: Make tags in notmuch-show header-line clickable
> [PATCH 3/4] emacs: Make all tags in `notmuch-show' clickable
> [PATCH 4/4] emacs: Add unit-tests for clickable tags
>
> These patches make clickable all tags that appear in notmuch-show
> buffers. Each tag is a link to open a new notmuch-search buffer for
> this tag. Additionally, the buffer's header-line now shows the
> thread's tags (clickable only if the `header-button' library is loaded
> or loadable).
>
> These patches are the first of an upcoming series whose goal is to
> integrate notmuch-labeler into notmuch. See the following for more
> details: https://github.com/DamienCassou/notmuch-labeler
>
> With respect to v3, I took care of the comments you made:
> - the header-line now updates when tags are changed
> - the tags in the body stays clickable when tags are changed
>
> Additionally, I added two unit tests to cover the above two comments
> and fixed some others unit tests of mine.
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  parent reply	other threads:[~2012-12-13 11:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11  9:00 Damien Cassou
2012-12-11  9:00 ` [PATCH 1/4] emacs: Add a thread's tags to notmuch-show header-line Damien Cassou
2012-12-11  9:00 ` [PATCH 2/4] emacs: Make tags in notmuch-show header-line clickable Damien Cassou
2012-12-11  9:00 ` [PATCH 3/4] emacs: Make all tags in `notmuch-show' clickable Damien Cassou
2012-12-11  9:00 ` [PATCH 4/4] emacs: Add unit-tests for clickable tags Damien Cassou
2012-12-13 11:45 ` Mark Walters [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-02-01 20:53 Matthew Lear
2018-02-03 22:38 ` Jani Nikula
2017-06-11 11:00 [PATCH] Add Emacs' imenu support in notmuch-show and notmuch-search David Bremner
2017-06-12 13:30 ` Damien Cassou
2017-06-14  1:22   ` David Bremner
2017-06-14  9:44     ` Re: David Bremner
2017-06-14  9:54       ` Re: Damien Cassou
2017-05-23 18:54 Tomi Ollila
2017-05-26 10:40 ` David Bremner
2016-10-15  8:44 Re: Matthew Lear
2016-10-13 19:37 Matt Armstrong
2016-10-13 19:42 ` Matt Armstrong
2016-10-11 21:24 matt
2016-10-12  7:51 ` Mark Walters
2016-10-15  7:09   ` Re: Mark Walters
2016-10-17 12:01 ` Re: David Bremner
2015-01-25 17:58 [PATCH 1/3] doc: add details about Xapian search syntax David Bremner
2015-02-23 20:05 ` David Bremner
2015-02-24  7:32   ` David Bremner
2014-10-03 21:18 David Bremner
2014-10-03 21:22 ` David Bremner
2014-10-16 21:14 ` Re: Jani Nikula
2014-05-06 13:06 David Bremner
2014-05-06 18:14 ` Jameson Graef Rollins
2014-05-06 18:26 ` Re: Tomi Ollila
2014-03-11 18:16 v2 man page build fixups Tomi Ollila
2014-03-13  3:21 ` David Bremner
2014-03-17 10:55   ` Tomi Ollila
2014-03-18 10:52   ` Re: David Bremner
2014-01-19 18:57 [RFC Patch] start of sphinx based docs David Bremner
2014-01-28 16:12 ` David Bremner
2014-01-28 22:54   ` Mark Walters
2014-01-29  2:26     ` Re: David Bremner
2013-02-25 20:44 Martin Owens
2013-02-25 21:02 ` David Bremner
2013-01-16 12:44 david
2013-01-17 10:36 ` David Bremner
2012-02-01  2:49 emacs: quote MML tags in replies Dmitry Kurochkin
2012-02-02  4:01 ` David Bremner
2012-02-03 10:22   ` Pieter Praet
2012-01-23  8:33 show-mode message/thread archiving improvements Jameson Graef Rollins
2012-01-25  0:06 ` Jameson Graef Rollins
2012-01-31  3:28   ` David Bremner
2011-10-09 16:01 output file argument to notmuch dump David Bremner
2011-10-10 13:49 ` david
2011-10-16 20:34   ` Thomas Schwinge
2011-10-16 23:25     ` Re: David Bremner

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=877gomdvka.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).