unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: tree: mark read change
@ 2015-06-09  9:51 Mark Walters
  2015-06-23 20:31 ` David Bremner
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Walters @ 2015-06-09  9:51 UTC (permalink / raw)
  To: notmuch

The mark read code for tree mode did not get updated in the recent
changes. This updates it to match. Since the user can customize the
mark read logic we just call the show logic in the message pane.
---

An alternative would be to mark any message explicitly viewed in
tree-mode as read. That would be simpler but I think this is better as
it deals with user customized mark read functions -- for example if
the user has a customized function that only marks a message read if
the whole message is viewed then this version will do the same in tree
mode.

Best wishes

Mark



emacs/notmuch-tree.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 8b6cd51..182235e 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -413,6 +413,13 @@ (defun notmuch-tree-message-window-kill-hook ()
       (ignore-errors
 	(delete-window notmuch-tree-message-window)))))
 
+(defun notmuch-tree-command-hook ()
+  (when (eq major-mode 'notmuch-tree-mode)
+    ;; We just run the notmuch-show-command-hook on the message pane.
+    (when (buffer-live-p notmuch-tree-message-buffer)
+      (with-current-buffer notmuch-tree-message-buffer
+	(notmuch-show-command-hook)))))
+
 (defun notmuch-tree-show-message-in ()
   "Show the current message (in split-pane)."
   (interactive)
@@ -855,6 +862,7 @@ (defun notmuch-tree-worker (basic-query &optional query-context target open-targ
 the same as for the function notmuch-tree."
   (interactive)
   (notmuch-tree-mode)
+  (add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context query-context)
   (setq notmuch-tree-target-msg target)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: tree: mark read change
  2015-06-09  9:51 [PATCH] emacs: tree: mark read change Mark Walters
@ 2015-06-23 20:31 ` David Bremner
  2015-06-23 21:14   ` Tomi Ollila
  0 siblings, 1 reply; 3+ messages in thread
From: David Bremner @ 2015-06-23 20:31 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> The mark read code for tree mode did not get updated in the recent
> changes. This updates it to match. Since the user can customize the
> mark read logic we just call the show logic in the message pane.
> ---
>
> An alternative would be to mark any message explicitly viewed in
> tree-mode as read. That would be simpler but I think this is better as
> it deals with user customized mark read functions -- for example if
> the user has a customized function that only marks a message read if
> the whole message is viewed then this version will do the same in tree
> mode.

At first I was leery of the chaining of hooks, but now that I
noticed/experienced the bug, it makes more sense to me.  I'm considering
rolling a bug fix release with this (I imagine the bug is pretty
annoying for people using only notmuch-tree), so I'd like a bit more
feedback before merging it.

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: tree: mark read change
  2015-06-23 20:31 ` David Bremner
@ 2015-06-23 21:14   ` Tomi Ollila
  0 siblings, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2015-06-23 21:14 UTC (permalink / raw)
  To: David Bremner, Mark Walters, notmuch

On Tue, Jun 23 2015, David Bremner <david@tethera.net> wrote:

> Mark Walters <markwalters1009@gmail.com> writes:
>
>> The mark read code for tree mode did not get updated in the recent
>> changes. This updates it to match. Since the user can customize the
>> mark read logic we just call the show logic in the message pane.
>> ---
>>
>> An alternative would be to mark any message explicitly viewed in
>> tree-mode as read. That would be simpler but I think this is better as
>> it deals with user customized mark read functions -- for example if
>> the user has a customized function that only marks a message read if
>> the whole message is viewed then this version will do the same in tree
>> mode.
>
> At first I was leery of the chaining of hooks, but now that I
> noticed/experienced the bug, it makes more sense to me.  I'm considering
> rolling a bug fix release with this (I imagine the bug is pretty
> annoying for people using only notmuch-tree), so I'd like a bit more
> feedback before merging it.

From code point of view it looks good to me.

Tomi

>
> d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-23 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09  9:51 [PATCH] emacs: tree: mark read change Mark Walters
2015-06-23 20:31 ` David Bremner
2015-06-23 21:14   ` Tomi Ollila

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).