Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 856B36DE19E9 for ; Sat, 2 Jan 2016 14:37:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9dxEfO8m0p5i for ; Sat, 2 Jan 2016 14:36:59 -0800 (PST) X-Greylist: delayed 360 seconds by postgrey-1.35 at arlo; Sat, 02 Jan 2016 14:36:59 PST Received: from labbe.ens-lyon.fr (labbe.ens-lyon.fr [140.77.167.222]) by arlo.cworth.org (Postfix) with ESMTP id 28AA26DE19CF for ; Sat, 2 Jan 2016 14:36:59 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by labbe.ens-lyon.fr (Postfix) with ESMTP id 9F83D320BCB for ; Sat, 2 Jan 2016 23:30:56 +0100 (CET) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at ens-lyon.fr Received: from labbe.ens-lyon.fr ([127.0.0.1]) by localhost (labbe.ens-lyon.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SP9a-OwXaIb2; Sat, 2 Jan 2016 23:30:56 +0100 (CET) Received: from goyave.phis.me (slsu0-06.dsi-ext.ens-lyon.fr [140.77.96.31]) by labbe.ens-lyon.fr (Postfix) with ESMTP id 8FC9E3206F4; Sat, 2 Jan 2016 23:30:55 +0100 (CET) Received: from goyave.phis.me. (localhost [127.0.0.1]) by goyave.phis.me (Postfix) with ESMTP id 4850E600524; Sat, 2 Jan 2016 23:33:35 +0100 (CET) From: Simon Castellan To: notmuch@notmuchmail.org Subject: [BUG] [notmuch-tree] Display problems when database is locked User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Sat, 02 Jan 2016 23:33:35 +0100 Message-ID: <874mev4nnk.fsf@goyave.phis.me> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2016 22:37:01 -0000 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. 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.