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

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

Date: Thu, 1 Mar 2012 21:24:38 +0100

To: notmuch@notmuchmail.org

Cc:

From: Daniel Schoepe


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.
---
 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


Thread: