]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: do not call `notmuch-hello-mode' on update
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Sun, 18 Dec 2011 00:21:21 +0000 (04:21 +0400)
committerDavid Bremner <bremner@debian.org>
Tue, 20 Dec 2011 11:42:31 +0000 (07:42 -0400)
`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
test/emacs

index ca3a3813a5dd31bb9cc3552fda4eb3a89eb00566..81b26059ab1a01dfbfdd5d93bd2f1a385f219511 100644 (file)
@@ -403,11 +403,16 @@ Complete list of currently available key bindings:
                     (progn
                       (widget-forward 1)
                       (widget-value (widget-at)))
                     (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))
 
     (unless (eq major-mode 'notmuch-hello-mode)
       (notmuch-hello-mode))
index b4c24448f795133bdc884bd30bd65168b21e6854..dffad0fc171a2fc93d1b1ffc58abe403a1cfe768 100755 (executable)
@@ -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_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*")
 counter=$(test_emacs \
     '(let ((notmuch-hello-mode-hook-counter 0))
        (kill-buffer "*notmuch-hello*")