[PATCH v2] emacs: Pass a copy to notmuch-saved-search-sort-function
authorDaniel Schoepe <daniel@schoepe.org>
Thu, 1 Mar 2012 20:24:38 +0000 (21:24 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:07 +0000 (09:45 -0800)
d9/4a56c30edd87742e31656ff5ac051c6dbcfa39 [new file with mode: 0644]

diff --git a/d9/4a56c30edd87742e31656ff5ac051c6dbcfa39 b/d9/4a56c30edd87742e31656ff5ac051c6dbcfa39
new file mode 100644 (file)
index 0000000..d7d8ddb
--- /dev/null
@@ -0,0 +1,111 @@
+Return-Path: <daniel@schoepe.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 5A851431FCB\r
+       for <notmuch@notmuchmail.org>; Thu,  1 Mar 2012 12:24:54 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.8\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.8 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id qOjNJqrq3-0q for <notmuch@notmuchmail.org>;\r
+       Thu,  1 Mar 2012 12:24:53 -0800 (PST)\r
+Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com\r
+       [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 1DC52431FAF\r
+       for <notmuch@notmuchmail.org>; Thu,  1 Mar 2012 12:24:49 -0800 (PST)\r
+Received: by eaa1 with SMTP id 1so504934eaa.26\r
+       for <notmuch@notmuchmail.org>; Thu, 01 Mar 2012 12:24:49 -0800 (PST)\r
+Received-SPF: pass (google.com: domain of daniel@schoepe.org designates\r
+       10.213.9.8 as permitted sender) client-ip=10.213.9.8; \r
+Authentication-Results: mr.google.com;\r
+       spf=pass (google.com: domain of daniel@schoepe.org\r
+       designates 10.213.9.8 as permitted sender)\r
+       smtp.mail=daniel@schoepe.org;\r
+       dkim=pass header.i=daniel@schoepe.org\r
+Received: from mr.google.com ([10.213.9.8])\r
+       by 10.213.9.8 with SMTP id j8mr692921ebj.102.1330633489013 (num_hops =\r
+       1); Thu, 01 Mar 2012 12:24:49 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schoepe.org; s=google;\r
+       h=mime-version:from:to:cc:subject:date:message-id:x-mailer\r
+       :in-reply-to:references;\r
+       bh=ycvLYn4YlGE8Vp8BciYfo7uhNRzWJ3Ap6mGnbKZuM8c=;\r
+       b=Jq1WBF2S8Iq9K0fA+SHpafNnwYM8W/WxjaPGFrWWqqsU0is6tGCmyi85mihE9pRK3w\r
+       gG/yZgSmvqtsjT/qYjtVnowsVPf9Yc7+iXzCtNOqoB6hjZ49C3jCOqphxPE9ij3D5T+Q\r
+       b39arZtyVPQI+DPEb1cluhFuBdvZfw40GM9z0=\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=mime-version:from:to:cc:subject:date:message-id:x-mailer\r
+       :in-reply-to:references:x-gm-message-state;\r
+       bh=ycvLYn4YlGE8Vp8BciYfo7uhNRzWJ3Ap6mGnbKZuM8c=;\r
+       b=W+Mm38U4lV5iMtceCXRjkmk59o6eEF7En9VL1uPyNkLuCu4aqSAG3woqPCKq0VN/A3\r
+       0K8OS46MEqWfnw9FmV1bKlF189WhyhS1vKkGWh94l+RsZpSTdEEnInrG0pDCYYz5KZd5\r
+       YYlLnG50RhYhOJ+LKBc+x0VK8PYqB41eabQCG4ofxJ8CAhyW9+ogJAonrrpnFfaUbA6j\r
+       yJ9CIvWRZFElT4kSA6ApMfnEyk1eKsbVHzMxa+Pp4s7jOMsEGVd/C2Z6PSXWUFg92PHn\r
+       OPMfzx6P/uQ0CLEjCch6S0Tk2PQaFbgPUUaie666TIklm/+3cNNZldNFVm/2k22oitz+\r
+       ne+A==\r
+MIME-Version: 1.0\r
+Received: by 10.213.9.8 with SMTP id j8mr525815ebj.102.1330633488389;\r
+       Thu, 01 Mar 2012 12:24:48 -0800 (PST)\r
+Received: from localhost (dslb-188-107-168-245.pools.arcor-ip.net.\r
+       [188.107.168.245])\r
+       by mx.google.com with ESMTPS id n52sm11126487eea.5.2012.03.01.12.24.46\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 01 Mar 2012 12:24:47 -0800 (PST)\r
+From: Daniel Schoepe <daniel@schoepe.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] emacs: Pass a copy to notmuch-saved-search-sort-function\r
+Date: Thu,  1 Mar 2012 21:24:38 +0100\r
+Message-Id: <1330633478-1974-2-git-send-email-daniel@schoepe.org>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1330633478-1974-1-git-send-email-daniel@schoepe.org>\r
+References: <1330613059-5130-1-git-send-email-daniel@schoepe.org>\r
+       <1330633478-1974-1-git-send-email-daniel@schoepe.org>\r
+X-Gm-Message-State:\r
+ ALoCoQlqNdG0Zjt+gHWKmdd/SYWCdyXlFkDswf6J7SnASrZr6A8pNHuYVdy+f4X42tV8Z5r1pvs+\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 01 Mar 2012 20:24:54 -0000\r
+\r
+notmuch-saved-search-sort-function might destructively modify its\r
+input (`sort' does that, for instance), so it should not be given\r
+notmuch-saved-searches directly.\r
+---\r
+ emacs/notmuch-hello.el |    5 ++++-\r
+ 1 files changed, 4 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index aad373d..e089290 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -575,7 +575,10 @@ Complete list of currently available key bindings:\r
+   (let ((searches (notmuch-hello-query-counts\r
+                  (if notmuch-saved-search-sort-function\r
+                      (funcall notmuch-saved-search-sort-function\r
+-                              notmuch-saved-searches)\r
++                              ;; Use a copy, since the sorting\r
++                              ;; function may have side effects,\r
++                              ;; e.g. if it just `sort's the input.\r
++                              (copy-sequence notmuch-saved-searches))\r
+                    notmuch-saved-searches)\r
+                  :show-empty-searches notmuch-show-empty-saved-searches))\r
+       found-target-pos)\r
+-- \r
+1.7.9.1\r
+\r