emacs: do not call `notmuch-hello-mode' on update

`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.
This commit is contained in:
Dmitry Kurochkin 2011-12-18 04:21:21 +04:00 committed by David Bremner
parent 9928b5b50f
commit 59adb2da19
2 changed files with 9 additions and 5 deletions

View file

@ -403,11 +403,16 @@ Complete list of currently available key bindings:
(progn (progn
(widget-forward 1) (widget-forward 1)
(widget-value (widget-at))) (widget-value (widget-at)))
(error nil))))) (error nil))))
(inhibit-read-only t))
(kill-all-local-variables) ;; Delete all editable widget fields. Editable widget fields are
(let ((inhibit-read-only t)) ;; tracked in a buffer local variable `widget-field-list' (and
(erase-buffer)) ;; 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) (unless (eq major-mode 'notmuch-hello-mode)
(notmuch-hello-mode)) (notmuch-hello-mode))

View file

@ -486,7 +486,6 @@ counter=$(test_emacs \
test_expect_equal "$counter" 1 test_expect_equal "$counter" 1
test_begin_subtest "notmuch-hello-mode hook is not called on updates" test_begin_subtest "notmuch-hello-mode hook is not called on updates"
test_subtest_known_broken
counter=$(test_emacs \ counter=$(test_emacs \
'(let ((notmuch-hello-mode-hook-counter 0)) '(let ((notmuch-hello-mode-hook-counter 0))
(kill-buffer "*notmuch-hello*") (kill-buffer "*notmuch-hello*")