[PATCH v3 4/4] emacs: do not call `notmuch-hello-mode' on update
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Sat, 17 Dec 2011 23:39:14 +0000 (03:39 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:59 +0000 (09:40 -0800)
ab/0d52f5334171420b74b7f1bcc623d62d739098 [new file with mode: 0644]

diff --git a/ab/0d52f5334171420b74b7f1bcc623d62d739098 b/ab/0d52f5334171420b74b7f1bcc623d62d739098
new file mode 100644 (file)
index 0000000..762a705
--- /dev/null
@@ -0,0 +1,109 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3A3BC429E32\r
+       for <notmuch@notmuchmail.org>; Sat, 17 Dec 2011 15:40:08 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id K4bYhdsWY9Nl for <notmuch@notmuchmail.org>;\r
+       Sat, 17 Dec 2011 15:40:07 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 9E0F2429E35\r
+       for <notmuch@notmuchmail.org>; Sat, 17 Dec 2011 15:40:06 -0800 (PST)\r
+Received: by mail-wi0-f181.google.com with SMTP id hq2so801993wib.26\r
+       for <notmuch@notmuchmail.org>; Sat, 17 Dec 2011 15:40:06 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=4GoT3cexxpZfudgHZMaifuLYOs0IXsTB7jrQnyd7lJU=;\r
+       b=FjxqXckhVXDat4gTkc2IlFH3Gc87J+gF5aIYAnhYCN+fZjWOPWiKSRqCATIveypGzo\r
+       cRl1ZK4p2f5wbpYkocrKoXDKtz7dVs7Jk0YKCRFTKevyXIhSvVo1mg8OGahwV+6kSCkU\r
+       PB6VXW5EZmxIS0myfIPCADNm1OP9+VoKZ7VME=\r
+Received: by 10.180.14.5 with SMTP id l5mr19792981wic.44.1324165206270;\r
+       Sat, 17 Dec 2011 15:40:06 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id gg1sm19966882wbb.17.2011.12.17.15.40.05\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 17 Dec 2011 15:40:05 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 4/4] emacs: do not call `notmuch-hello-mode' on update\r
+Date: Sun, 18 Dec 2011 03:39:14 +0400\r
+Message-Id: <1324165154-5728-5-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <1324165154-5728-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+References: <1324095619-10870-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+       <1324165154-5728-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 17 Dec 2011 23:40:08 -0000\r
+\r
+`notmuch-hello' should call `notmuch-hello-mode' function only when\r
+run for the first time.  But before the change, `notmuch-hello' used\r
+`kill-all-local-variables' to remove editable widgets fields.  This\r
+caused the major mode to be reset, and `notmuch-hello-mode' to be\r
+called every time.\r
+\r
+The patch manually deletes all editable widget fields and removes\r
+`kill-all-local-variables' call.\r
+---\r
+ emacs/notmuch-hello.el |   10 ++++++----\r
+ test/emacs             |    1 -\r
+ 2 files changed, 6 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index ca3a381..c158e89 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -403,11 +403,13 @@ Complete list of currently available key bindings:\r
+                    (progn\r
+                      (widget-forward 1)\r
+                      (widget-value (widget-at)))\r
+-                 (error nil)))))\r
++                 (error nil))))\r
++      (inhibit-read-only t))\r
\r
+-    (kill-all-local-variables)\r
+-    (let ((inhibit-read-only t))\r
+-      (erase-buffer))\r
++    ;; delete all editable widget fields\r
++    (mapc 'widget-delete widget-field-list)\r
++\r
++    (erase-buffer)\r
\r
+     (unless (eq major-mode 'notmuch-hello-mode)\r
+       (notmuch-hello-mode))\r
+diff --git a/test/emacs b/test/emacs\r
+index b4c2444..dffad0f 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -486,7 +486,6 @@ counter=$(test_emacs \\r
+ test_expect_equal "$counter" 1\r
\r
+ test_begin_subtest "notmuch-hello-mode hook is not called on updates"\r
+-test_subtest_known_broken\r
+ counter=$(test_emacs \\r
+     '(let ((notmuch-hello-mode-hook-counter 0))\r
+        (kill-buffer "*notmuch-hello*")\r
+-- \r
+1.7.7.3\r
+\r