emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH 2/2] lisp/ob.el: Don't modify babel info when hashing it


From: Eric Schulte
Subject: Re: [O] [PATCH 2/2] lisp/ob.el: Don't modify babel info when hashing it
Date: Thu, 02 Jun 2011 12:22:07 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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 <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]