From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4E520429E28 for ; Sat, 17 Dec 2011 16:22:15 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5V9VROaqw-jr for ; Sat, 17 Dec 2011 16:22:12 -0800 (PST) Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 84DD9429E35 for ; Sat, 17 Dec 2011 16:22:12 -0800 (PST) Received: by mail-ww0-f41.google.com with SMTP id dt12so4921505wgb.2 for ; Sat, 17 Dec 2011 16:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=BIqqH+bnxU/yXZF5WyLLmlZqmL/yj9KS6jor84C+WY8=; b=iFzTjM4ekUOYq13N/mhfODqksVNEtpeA3WI0qo3DgCifJPWUb7cJh4PDNuWFlKVzrh nIg2byBtVrzn8IbAn+a1RHijCFktOBm7VbU54albuZz+WeA7nxhU4Rmh53rrPqwxUygu 4GcxJTwSjLWkLCvku9I4h8KZWZtjIyWC293dI= Received: by 10.180.105.232 with SMTP id gp8mr19564181wib.65.1324167732177; Sat, 17 Dec 2011 16:22:12 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id er5sm20080419wbb.11.2011.12.17.16.22.11 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 17 Dec 2011 16:22:11 -0800 (PST) From: Dmitry Kurochkin To: notmuch@notmuchmail.org Subject: [PATCH v4 4/4] emacs: do not call `notmuch-hello-mode' on update Date: Sun, 18 Dec 2011 04:21:21 +0400 Message-Id: <1324167681-26984-5-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1324167681-26984-1-git-send-email-dmitry.kurochkin@gmail.com> References: <1324095619-10870-1-git-send-email-dmitry.kurochkin@gmail.com> <1324167681-26984-1-git-send-email-dmitry.kurochkin@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Sun, 18 Dec 2011 00:22:15 -0000 `notmuch-hello' should call `notmuch-hello-mode' function only when run for the first time. But before the change, `notmuch-hello' used `kill-all-local-variables' to remove editable widgets fields. This caused the major mode to be reset, and `notmuch-hello-mode' to be called every time. The patch manually deletes all editable widget fields and removes `kill-all-local-variables' call. --- emacs/notmuch-hello.el | 13 +++++++++---- test/emacs | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index ca3a381..81b2605 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -403,11 +403,16 @@ Complete list of currently available key bindings: (progn (widget-forward 1) (widget-value (widget-at))) - (error nil))))) + (error nil)))) + (inhibit-read-only t)) - (kill-all-local-variables) - (let ((inhibit-read-only t)) - (erase-buffer)) + ;; Delete all editable widget fields. Editable widget fields are + ;; tracked in a buffer local variable `widget-field-list' (and + ;; others). If we do `erase-buffer' without properly deleting the + ;; widgets, some widget-related functions are confused later. + (mapc 'widget-delete widget-field-list) + + (erase-buffer) (unless (eq major-mode 'notmuch-hello-mode) (notmuch-hello-mode)) diff --git a/test/emacs b/test/emacs index b4c2444..dffad0f 100755 --- a/test/emacs +++ b/test/emacs @@ -486,7 +486,6 @@ counter=$(test_emacs \ test_expect_equal "$counter" 1 test_begin_subtest "notmuch-hello-mode hook is not called on updates" -test_subtest_known_broken counter=$(test_emacs \ '(let ((notmuch-hello-mode-hook-counter 0)) (kill-buffer "*notmuch-hello*") -- 1.7.7.3