[PATCH v2 0/9] emacs: Unify common key bindings and lots more

Tomi Ollila tomi.ollila at iki.fi
Mon Sep 9 09:59:40 PDT 2013


On Wed, Sep 04 2013, Austin Clements <amdragon at MIT.EDU> wrote:

> This is v2 of id:1377793557-28878-1-git-send-email-amdragon at mit.edu.
> This fixes a problem found by Jani where notmuch-hello would reset
> point placement when refreshing in Emacs 24.  It also inverts the
> sense of notmuch-hello-auto-refresh and makes it a defcustom
> (originally I'd intended notmuch-hello-inhibit-auto-refresh for
> internal use only, but both Mark and Jani expressed interest in
> setting it).

I've been using this patch series a few days now it has worked fine.
It took me a while to grok the notmuch-hello-window-configuration-change
which imo provides nice piece of functionality.

The whole patch series LGTM.

Tomi

>
> The diff from v1 follows
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 1d6c3a2..55c416a 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -232,6 +232,11 @@ supported for \"Customized queries section\" items."
>  	    notmuch-hello-query-section
>  	    (function :tag "Custom section"))))
>  
> +(defcustom notmuch-hello-auto-refresh t
> +  "Automatically refresh when returning to the notmuch-hello buffer."
> +  :group 'notmuch-hello
> +  :type 'boolean)
> +
>  (defvar notmuch-hello-hidden-sections nil
>    "List of sections titles whose contents are hidden")
>  
> @@ -478,9 +483,6 @@ Such a list can be computed with `notmuch-hello-query-counts'."
>    ;; Lazy - rebuild everything.
>    (notmuch-hello no-display))
>  
> -(defvar notmuch-hello-inhibit-auto-refresh nil
> -  "Don't refresh notmuch-hello on window configuration changes.")
> -
>  (defun notmuch-hello-window-configuration-change ()
>    "Hook function to update the hello buffer when it is switched to."
>    (let ((hello-buf (get-buffer "*notmuch-hello*"))
> @@ -501,8 +503,11 @@ Such a list can be computed with `notmuch-hello-query-counts'."
>  	    ;; is currently visible, was not visible on the last
>  	    ;; configuration change, and this is not a new window)
>  	    (setq do-refresh t)))))
> -    (when (and do-refresh (not notmuch-hello-inhibit-auto-refresh))
> -      (notmuch-hello t))
> +    (when (and do-refresh notmuch-hello-auto-refresh)
> +      ;; Refresh hello as soon as we get back to redisplay.  On Emacs
> +      ;; 24, we can't do it right here because something in this
> +      ;; hook's call stack overrides hello's point placement.
> +      (run-at-time nil nil #'notmuch-hello t))
>      (when (null hello-buf)
>        ;; Clean up hook
>        (remove-hook 'window-configuration-change-hook
> @@ -785,14 +790,15 @@ following:
>  
>    ;; This may cause a window configuration change, so if the
>    ;; auto-refresh hook is already installed, avoid recursive refresh.
> -  (let ((notmuch-hello-inhibit-auto-refresh t))
> +  (let ((notmuch-hello-auto-refresh nil))
>      (if no-display
>  	(set-buffer "*notmuch-hello*")
>        (switch-to-buffer "*notmuch-hello*")))
>  
>    ;; Install auto-refresh hook
> -  (add-hook 'window-configuration-change-hook
> -	    #'notmuch-hello-window-configuration-change)
> +  (when notmuch-hello-auto-refresh
> +    (add-hook 'window-configuration-change-hook
> +	      #'notmuch-hello-window-configuration-change))
>  
>    (let ((target-line (line-number-at-pos))
>  	(target-column (current-column))
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>

-- 
"kaik on mänt!"


More information about the notmuch mailing list