emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Lawrence Mitchell <wence@gmx.li>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH 2/2] lisp/ob.el: Don't modify babel info when hashing it
Date: Thu, 02 Jun 2011 12:22:07 -0600	[thread overview]
Message-ID: <87y61k9jil.fsf@gmail.com> (raw)
In-Reply-To: 1307009045-10010-2-git-send-email-wence@gmx.li

Hi Lawrence,

Is there a reason to make this copy?  Given that params is used like a
hash/dictionary the order of it's elements should not matter.  Is there
a case where this patch is necessary to avoid buggy behavior?

If so then I'm happy to apply the patch, but if there is no need then
I'd rather avoid the (admittedly small) overhead of making a copy of the
params list.

Thanks -- Eric

Lawrence Mitchell <wence@gmx.li> writes:

> * lisp/ob.el (org-babel-sha1-hash): Don't modify info argument by
> side-effect when sorting result-params list.
>
> copy-sequence only does shallow copies, so if we're going to modify a
> sub-list, we need to make sure we copy it first.
> ---
>  lisp/ob.el |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/ob.el b/lisp/ob.el
> index e1f4372..36649f0 100644
> --- a/lisp/ob.el
> +++ b/lisp/ob.el
> @@ -767,7 +767,7 @@ the current subtree."
>  				  (cond
>  				   ((and (listp v) ; lists are sorted
>  					 (member (car arg) '(:result-params)))
> -				    (sort v #'string<))
> +				    (sort (copy-sequence v) #'string<))
>  				   ((and (stringp v) ; strings are sorted
>  					 (member (car arg) '(:results :exports)))
>  				    (mapconcat #'identity (sort (split-string v)

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  reply	other threads:[~2011-06-02 18:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 10:04 [PATCH 1/2] lisp/ob.el: Fix org-babel-result-regexp to match users Lawrence Mitchell
2011-06-02 10:04 ` [PATCH 2/2] lisp/ob.el: Don't modify babel info when hashing it Lawrence Mitchell
2011-06-02 18:22   ` Eric Schulte [this message]
2011-06-03  8:33     ` Lawrence Mitchell
2011-06-02 18:20 ` [PATCH 1/2] lisp/ob.el: Fix org-babel-result-regexp to match users Eric Schulte

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://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y61k9jil.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=wence@gmx.li \
    /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://git.savannah.gnu.org/cgit/emacs/org-mode.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).