From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bill Wishon Subject: Re: Documentation vs. implementation for org-properties-postprocess-alist Date: Sun, 29 Apr 2012 08:50:19 -0700 Message-ID: References: <87ipgig9ej.fsf@altern.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=485b390f79aa6b6ae104bed34b25 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:36430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOWOH-0000zP-0s for emacs-orgmode@gnu.org; Sun, 29 Apr 2012 11:50:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SOWOF-0005Ob-0d for emacs-orgmode@gnu.org; Sun, 29 Apr 2012 11:50:24 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:50837) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOWOE-0005OB-K5 for emacs-orgmode@gnu.org; Sun, 29 Apr 2012 11:50:22 -0400 Received: by lbjn8 with SMTP id n8so1251142lbj.0 for ; Sun, 29 Apr 2012 08:50:19 -0700 (PDT) In-Reply-To: <87ipgig9ej.fsf@altern.org> 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: Bastien Cc: emacs-orgmode@gnu.org --485b390f79aa6b6ae104bed34b25 Content-Type: text/plain; charset=ISO-8859-1 Hi Bastien, I just did a pull this morning against the latest in git and the code is the same. The definition of the variable org-property-postprocess-alist says that it should be a list of lists where each inner list's car is a string and cdr is a function. I think the doc string for the variable sounds right. But if you look at the function org-set-property what it does is set fn to (assoc property org-property-postprocses-alist), which is a list whose car is property and cdr is the function. Then later the function does (funcall (cadr fn) value). The cdr of fn is the (lambda () ...) function. I'm not sure what the car of a lambda function is, but it's not what should be passed to funcall. Instead what I think should happen is that fn should be set to the lambda function itself initially by calling cdr on the result of assoc. Now fn has the lambda function as it's value, so that later on when the test for non-nil fn is done you can then simply do (funcall fn value) without the extra cadr. Another fix would be to change the cadr of fn to just cdr of fn. But then the test says if the list is non-nil then call the function which is the cdr of fn, but that could be nil at that point since it wasn't checked. Best, ~>Bill On Sun, Apr 29, 2012 at 2:43 AM, Bastien wrote: > Hi Bill, > > Bill Wishon writes: > > > While hacking around I read the doc for > > org-properties-postprocess-alist and I think it doesn't align with > > what the implementation of org-set-property does. > > I don't see anything wrong. Can you double-check? If there is a > problem, please tell us what version of Org you are using. > > Thanks, > > -- > Bastien > --485b390f79aa6b6ae104bed34b25 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Bastien,

I just did a pull this mornin= g against the latest in git and the code is the same.

The definition= of the variable org-property-postprocess-alist says that it should be a li= st of lists where each inner list's car is a string and cdr is a functi= on.=A0 I think the doc string for the variable sounds right.=A0 But if you = look at the function org-set-property what it does is set fn to (assoc prop= erty org-property-postprocses-alist), which is a list whose car is property= and cdr is the function.=A0 Then later the function does (funcall (cadr fn= ) value).=A0 The cdr of fn is the (lambda () ...) function.=A0 I'm not = sure what the car of a lambda function is, but it's not what should be = passed to funcall.

Instead what I think should happen is that fn should be set to the lamb= da function itself initially by calling cdr on the result of assoc.=A0 Now = fn has the lambda function as it's value, so that later on when the tes= t for non-nil fn is done you can then simply do (funcall fn value) without = the extra cadr.=A0 Another fix would be to change the cadr of fn to just cd= r of fn.=A0 But then the test says if the list is non-nil then call the fun= ction which is the cdr of fn, but that could be nil at that point since it = wasn't checked.

Best,
~>Bill

On Sun, Apr 29, 2012 at 2:43 AM, Bastien <bzg@gnu.= org> wrote:
Hi Bill,

Bill Wishon <bill@wishon.org> = writes:

> While hacking around I read the doc for
> org-properties-postprocess-alist and I think it doesn't align with=
> what the implementation of org-set-property does.

I don't see anything wrong. =A0Can you double-check? =A0If there = is a
problem, please tell us what version of Org you are using.

Thanks,

--
=A0Bastien

--485b390f79aa6b6ae104bed34b25--