From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
To: Daniel Schoepe <daniel@schoepe.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH v2] emacs: Pass a copy to notmuch-saved-search-sort-function
Date: Mon, 05 Mar 2012 06:21:52 +0400 [thread overview]
Message-ID: <87booblrcv.fsf@gmail.com> (raw)
In-Reply-To: <1330633478-1974-2-git-send-email-daniel@schoepe.org>
On Thu, 1 Mar 2012 21:24:38 +0100, Daniel Schoepe <daniel@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.
> ---
-1
I think we should require `notmuch-saved-search-sort-function' not to
have side effects. Current documentation should be more clear about
this. We need to fix `notmuch-sort-saved-searches' to copy the list
before calling `sort'. But we should not do it in
`notmuch-hello-insert-saved-searches' for any sorting function (which
may not need this copying).
Regards,
Dmitry
> 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@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
next prev parent reply other threads:[~2012-03-05 2:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-01 14:44 [PATCH 0/1] emacs: Pass a copy to notmuch-saved-search-sort-function Daniel Schoepe
2012-03-01 14:44 ` [PATCH] " Daniel Schoepe
2012-03-05 20:55 ` [PATCH v2] " Jani Nikula
2012-03-05 21:08 ` Daniel Schoepe
2012-03-05 21:09 ` Dmitry Kurochkin
2012-03-06 8:20 ` Jani Nikula
2012-03-01 20:24 ` [PATCH v2 0/1] " Daniel Schoepe
2012-03-01 20:24 ` [PATCH v2] " Daniel Schoepe
2012-03-03 21:36 ` Jani Nikula
2012-03-05 2:21 ` Dmitry Kurochkin [this message]
2012-03-05 11:17 ` Daniel Schoepe
2012-03-05 15:23 ` Tomi Ollila
2012-03-05 15:42 ` Dmitry Kurochkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87booblrcv.fsf@gmail.com \
--to=dmitry.kurochkin@gmail.com \
--cc=daniel@schoepe.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).