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

Daniel Schoepe daniel at schoepe.org
Thu Mar 1 06:44:19 PST 2012


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..b2b22df 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-seq notmuch-saved-searches))
 		     notmuch-saved-searches)
 		   :show-empty-searches notmuch-show-empty-saved-searches))
 	found-target-pos)
-- 
1.7.9.1



More information about the notmuch mailing list