[BUG] [notmuch-tree] Display problems when database is locked
Mark Walters
markwalters1009 at gmail.com
Wed Sep 21 01:19:35 PDT 2016
Hi
On Sat, 02 Jan 2016, Simon Castellan <simon_notmuch at phis.me> wrote:
> Hi,
>
> I'm using notmuch-tree and I encountered a slightly annoying bug. When
> browsing through a notmuch-tree buffer, if I open up a message whose
> tags needs to be changed (eg. the message needs to be marked read), then
> on the /next/ message, the bottom part of the pane does not get killed
> and thus, the top part (which is tiny) of the pane gets split again.
Sorry I overlooked this originally. I think this is fixed in latest
master (by commit dd5cd6964fe074c79c1850abb82d805bca35a5c5 ). I don't
think the fix has made it into any release yet but 0.23 will be released
fairly soon. If you can reproduce it on current master please let me
know.
Many thanks for the bug-report and sorry again for overlooking it
before.
Best wishes
Mark
>
> How to reproduce [I'm using notmuch-0.21 and emacs 24.4.1 from debian]
> ----------------
>
> 1. Mark some messages to be unread and then run (notmuch-tree
> "is:unread")
>
> 2. Make sure your notmuch database is locked (for that purpose I run a
> `while true; do notmuch new; done` in a side terminal)
>
> 3. Open the first unread message, then press "n" to go the next one.
> At this point, the screen should be split in three instead of two.
>
> How to fix it
> -------------
>
> This is due to notmuch-show not returning when the database is locked
> and the message cannot be marked read. This results in the end of
> notmuch-tree-show-message-in not being executed and some variable
> (namely notmuch-tree-message-buffer) having wrong values.
>
> I am not sure what is the best way to fix it, but what I'm using at a
> hack is to wrap around the call to notmuch-show in a
> `with-demoted-errors` so that the execution can continue in case of
> failure, and close the bottom part in case of a failure. Hence when this
> happens, the bottom part disappears which is better than messing up the
> window configuration. This is what it looks like:
>
> (defun notmuch-tree-show-message-in ()
> "Show the current message (in split-pane)."
> (interactive)
> (let ((id (notmuch-tree-get-message-id))
> (inhibit-read-only t)
> buffer)
> (when id
> ;; We close and reopen the window to kill off un-needed buffers
> ;; this might cause flickering but seems ok.
> (notmuch-tree-close-message-window)
> (setq notmuch-tree-message-window
> (split-window-vertically (/ (window-height) 4)))
> (with-selected-window notmuch-tree-message-window
> ;; Since we are only displaying one message do not indent.
> (let ((notmuch-show-indent-messages-width 0)
> (notmuch-show-only-matching-messages t))
> (setq buffer (with-demoted-errors (notmuch-show id)))))
> (unless buffer
> (delete-window notmuch-tree-message-window))
> (when buffer
> ;; We need the `let' as notmuch-tree-message-window is buffer local.
> (let ((window notmuch-tree-message-window))
> (with-current-buffer buffer
> (setq notmuch-tree-message-window window)
> (add-hook 'kill-buffer-hook 'notmuch-tree-message-window-kill-hook)))
> (setq notmuch-tree-message-buffer buffer)
> (when notmuch-show-mark-read-tags
> (notmuch-tree-tag-update-display notmuch-show-mark-read-tags))
> ))))
>
>
> Cheers,
>
> Simon.
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
More information about the notmuch
mailing list