[PATCH v3 4/4] emacs: do not call `notmuch-hello-mode' on update

Austin Clements amdragon at MIT.EDU
Sat Dec 17 16:16:07 PST 2011


This series looks good to me.  Just one nit below.

Quoth Dmitry Kurochkin on Dec 18 at  3:39 am:
> `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 |   10 ++++++----
>  test/emacs             |    1 -
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index ca3a381..c158e89 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -403,11 +403,13 @@ 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

It would be good to explain why this is necessary, so future
generations of notmuchers aren't as confused as I was by why this
dance is needed.

> +    (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*")


More information about the notmuch mailing list