From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte 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 Message-ID: <87y61k9jil.fsf@gmail.com> References: <1307009045-10010-1-git-send-email-wence@gmx.li> <1307009045-10010-2-git-send-email-wence@gmx.li> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:37342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSCmQ-0004Cb-4x for emacs-orgmode@gnu.org; Thu, 02 Jun 2011 14:38:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QSCmO-000638-EB for emacs-orgmode@gnu.org; Thu, 02 Jun 2011 14:38:01 -0400 Received: from mail-pw0-f41.google.com ([209.85.160.41]:53591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSCbn-00049r-Ao for emacs-orgmode@gnu.org; Thu, 02 Jun 2011 14:27:03 -0400 Received: by mail-pw0-f41.google.com with SMTP id 12so762278pwi.0 for ; Thu, 02 Jun 2011 11:27:03 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Lawrence Mitchell Cc: emacs-orgmode@gnu.org 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 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/