Re: [PATCH v2] emacs: Pass a copy to notmuch-saved-search-sort-function
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Mon, 5 Mar 2012 02:21:52 +0000 (06:21 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:14 +0000 (09:45 -0800)
77/fee9aee758059f3bc2f947fe62a7ddf164a845 [new file with mode: 0644]

diff --git a/77/fee9aee758059f3bc2f947fe62a7ddf164a845 b/77/fee9aee758059f3bc2f947fe62a7ddf164a845
new file mode 100644 (file)
index 0000000..31af3cd
--- /dev/null
@@ -0,0 +1,122 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\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 4AE2E431FAF\r
+       for <notmuch@notmuchmail.org>; Sun,  4 Mar 2012 18:23:24 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, 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 paNqH1081TRY for <notmuch@notmuchmail.org>;\r
+       Sun,  4 Mar 2012 18:23:23 -0800 (PST)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 58D91431FAE\r
+       for <notmuch@notmuchmail.org>; Sun,  4 Mar 2012 18:23:23 -0800 (PST)\r
+Received: by bkwj4 with SMTP id j4so3177411bkw.26\r
+       for <notmuch@notmuchmail.org>; Sun, 04 Mar 2012 18:23:22 -0800 (PST)\r
+Received-SPF: pass (google.com: domain of dmitry.kurochkin@gmail.com\r
+       designates 10.205.137.15 as permitted sender)\r
+       client-ip=10.205.137.15; \r
+Authentication-Results: mr.google.com; spf=pass (google.com: domain of\r
+       dmitry.kurochkin@gmail.com designates 10.205.137.15 as\r
+       permitted sender) smtp.mail=dmitry.kurochkin@gmail.com;\r
+       dkim=pass header.i=dmitry.kurochkin@gmail.com\r
+Received: from mr.google.com ([10.205.137.15])\r
+       by 10.205.137.15 with SMTP id im15mr9673084bkc.54.1330914202048\r
+       (num_hops = 1); Sun, 04 Mar 2012 18:23:22 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=FQ9q39l5je6wROyDiS82KQs0Hzz8a3EMiwFuGy+ByWw=;\r
+       b=LvXC3hJKBKwZYQUSv90tblDsOXSG1VBewLDbTS/PffaQZxVXdSMs1LcUx4C6SngHIs\r
+       8JkYVwXS5uiAotX/NfbAg28o3TJqlTPILlITRAA9gByBGHD0PZRZt9s8Tix2iTCROoQ3\r
+       qnSejNVldBMGRB+xXMQFUpD1cGmlFgftX7QoUSMgX4n5G7faPuK2pLdlq8KjqGERi0FH\r
+       iJSE/aVRZQ2ykdZcU23bh8GO3GtEfhQHTrwm7YH6IICBlPQj+i6sRNw9roitWQD/NhHU\r
+       HSa1Ru8RJhg1BCHvnHuRI+SpVUKV1vneAxgArtBx5cu4kfhNdOwcp4Bl7BL7dQpFQipe\r
+       cOWQ==\r
+Received: by 10.205.137.15 with SMTP id im15mr7652289bkc.54.1330914201950;\r
+       Sun, 04 Mar 2012 18:23:21 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id u14sm10256664bkp.2.2012.03.04.18.23.19\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sun, 04 Mar 2012 18:23:21 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: Daniel Schoepe <daniel@schoepe.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2] emacs: Pass a copy to\r
+       notmuch-saved-search-sort-function\r
+In-Reply-To: <1330633478-1974-2-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
+       <1330633478-1974-2-git-send-email-daniel@schoepe.org>\r
+User-Agent: Notmuch/0.11.1+288~g4b3af0e (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 05 Mar 2012 06:21:52 +0400\r
+Message-ID: <87booblrcv.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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: Mon, 05 Mar 2012 02:23:24 -0000\r
+\r
+On Thu,  1 Mar 2012 21:24:38 +0100, Daniel Schoepe <daniel@schoepe.org> wrote:\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
+\r
+-1\r
+\r
+I think we should require `notmuch-saved-search-sort-function' not to\r
+have side effects.  Current documentation should be more clear about\r
+this.  We need to fix `notmuch-sort-saved-searches' to copy the list\r
+before calling `sort'.  But we should not do it in\r
+`notmuch-hello-insert-saved-searches' for any sorting function (which\r
+may not need this copying).\r
+\r
+Regards,\r
+  Dmitry\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r