[PATCH v2] emacs: Pass a copy to notmuch-saved-search-sort-function

Jani Nikula jani at nikula.org
Sat Mar 3 13:36:54 PST 2012


On Thu,  1 Mar 2012 21:24:38 +0100, Daniel Schoepe <daniel at schoepe.org> wrote:
> notmuch-saved-search-sort-function might destructively modify its
> input (`sort' does that, for instance), so it should not be given
> notmuch-saved-searches directly.

Hi Daniel, thanks for fixing this. Works for me.

Full disclosure: I put the broken sort usage there in the first place...

BR,
Jani.


> ---
>  emacs/notmuch-hello.el |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index aad373d..e089290 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -575,7 +575,10 @@ Complete list of currently available key bindings:
>    (let ((searches (notmuch-hello-query-counts
>  		   (if notmuch-saved-search-sort-function
>  		       (funcall notmuch-saved-search-sort-function
> -				notmuch-saved-searches)
> +				;; Use a copy, since the sorting
> +				;; function may have side effects,
> +				;; e.g. if it just `sort's the input.
> +				(copy-sequence notmuch-saved-searches))
>  		     notmuch-saved-searches)
>  		   :show-empty-searches notmuch-show-empty-saved-searches))
>  	found-target-pos)
> -- 
> 1.7.9.1
> 
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list