[Patch v4 1/3] emacs: split notmuch-show-apply-state
Austin Clements
amdragon at MIT.EDU
Sat Apr 28 17:57:36 PDT 2012
Hmm. I think this will wind up spuriously marking messages read. If
notmuch-show-refresh-view is called with reset-state set to t, it will
mark the first open message read, before you move to the previously
current message.
IMO, notmuch-show-refresh-view should not be marking messages read at
all, but I tried to separate out that functionality before and failed.
Perhaps you can find a good way to do it. A more incremental but
slightly lame approach could be to pass some symbol for reset-state
that indicates it should reset the open state, but not the
position... and not mark anything read. Ugh.
Quoth Mark Walters on Apr 29 at 1:06 am:
> Separate out a notmuch-show-goto-msg-id sub-function from
> notmuch-show-apply-state. There should be no functional change but the
> next patch will call the new function.
> ---
> emacs/notmuch-show.el | 18 +++++++++++-------
> 1 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 30b26d1..3bd9a64 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1085,6 +1085,16 @@ This includes:
> - the current message."
> (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
>
> +(defun notmuch-show-goto-message (msg-id)
> + "Go to message with msg-id."
> + (goto-char (point-min))
> + (unless (loop if (string= msg-id (notmuch-show-get-message-id))
> + return t
> + until (not (notmuch-show-goto-message-next)))
> + (goto-char (point-min))
> + (message "Message-id not found."))
> + (notmuch-show-message-adjust))
> +
> (defun notmuch-show-apply-state (state)
> "Apply STATE to the current buffer.
>
> @@ -1102,13 +1112,7 @@ This includes:
> until (not (notmuch-show-goto-message-next)))
>
> ;; Go to the previously open message.
> - (goto-char (point-min))
> - (unless (loop if (string= current (notmuch-show-get-message-id))
> - return t
> - until (not (notmuch-show-goto-message-next)))
> - (goto-char (point-min))
> - (message "Previously current message not found."))
> - (notmuch-show-message-adjust)))
> + (notmuch-show-goto-message current)))
>
> (defun notmuch-show-refresh-view (&optional reset-state)
> "Refresh the current view.
--
Austin Clements MIT/'06/PhD/CSAIL
amdragon at mit.edu http://web.mit.edu/amdragon
Somewhere in the dream we call reality you will find me,
searching for the reality we call dreams.
More information about the notmuch
mailing list