]> rtime.felk.cvut.cz Git - notmuch.git/commit
emacs: show: add an update seen function to post-command-hook
authorMark Walters <markwalters1009@gmail.com>
Fri, 9 May 2014 00:20:08 +0000 (01:20 +0100)
committerDavid Bremner <david@tethera.net>
Sun, 13 Jul 2014 15:34:02 +0000 (12:34 -0300)
commit2e1eee3a77114465a3ad4872067a41caa2c1221d
tree72d63d1e1ba666fb5a484b00ba92dcd2b0d34ebe
parenteed6c75556e18d943ac690598edceef0c4ee59d5
emacs: show: add an update seen function to post-command-hook

Add a function for updating seen messages to the
post-command-hook. This function calls a customizable (by eg
defcustom) function with parameters the start and end of the current
window and that function can decide what to mark read based on that
and the current point.

Since this is in the post-command-hook it should get called after most
user actions (exceptions include user resizing the window) so it
should be possible to make sure the seen status gets updated whether
the user uses notmuch commands like next-message or normal emacs
commands like scroll-up.

It removes all of the old mark read/seen points but introduces a
simple example function that just marks the current message read if it
is open. This function has one small subtlety: it makes sure it
doesn't mark the same message read twice (in the same instance of the
same buffer); otherwise the post-command-hook makes it impossible for
a user to manually mark a message unread.

This fixes the current bugs (imo) that closed messages can be marked
read, and that opening a closed message does not mark it read.

Another advantage of using the post-command-hook any programmatic use
with point passing through a message will not mark it read.
emacs/notmuch-show.el