emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Documentation vs. implementation for org-properties-postprocess-alist
@ 2012-04-23  4:54 Bill Wishon
  2012-04-29  9:43 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Bill Wishon @ 2012-04-23  4:54 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1412 bytes --]

Hi,

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.

The example in the docstring says:

    (("Remaining" (lambda(value)
                      (let ((clocksum (org-clock-sum-current-item))
                            (effort (org-duration-string-to-minutes
                                      (org-entry-get (point) "Effort"))))
                        (org-minutes-to-hh:mm-string (- effort
clocksum))))))

But in order for this to work with the implementation I think it would need
to be :

    (("Remaining" ((lambda(value)
                      (let ((clocksum (org-clock-sum-current-item))
                            (effort (org-duration-string-to-minutes
                                      (org-entry-get (point) "Effort"))))
                        (org-minutes-to-hh:mm-string (- effort
clocksum)))))))

Adding extra parens around the lambda expression in the example to make it
a list.  Either that or the implementation of org-set-property should
change to :

$ diff org.el org.el.new
14593c14593
<        (fn (assoc property org-properties-postprocess-alist)))
---
>        (fn (cdr (assoc property org-properties-postprocess-alist))))
14596c14596
<     (when fn (setq value (funcall (cadr fn) value)))
---
>     (when fn (setq value (funcall fn value)))

What do you think?

~>Bill

[-- Attachment #2: Type: text/html, Size: 1596 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Documentation vs. implementation for org-properties-postprocess-alist
  2012-04-23  4:54 Documentation vs. implementation for org-properties-postprocess-alist Bill Wishon
@ 2012-04-29  9:43 ` Bastien
  2012-04-29 15:50   ` Bill Wishon
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2012-04-29  9:43 UTC (permalink / raw)
  To: Bill Wishon; +Cc: emacs-orgmode

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.  Can you double-check?  If there is a
problem, please tell us what version of Org you are using.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Documentation vs. implementation for org-properties-postprocess-alist
  2012-04-29  9:43 ` Bastien
@ 2012-04-29 15:50   ` Bill Wishon
  2012-04-29 16:07     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Bill Wishon @ 2012-04-29 15:50 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]

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 <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.  Can you double-check?  If there is a
> problem, please tell us what version of Org you are using.
>
> Thanks,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 2213 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Documentation vs. implementation for org-properties-postprocess-alist
  2012-04-29 15:50   ` Bill Wishon
@ 2012-04-29 16:07     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2012-04-29 16:07 UTC (permalink / raw)
  To: Bill Wishon; +Cc: emacs-orgmode

Hi Bill,

all right, I pushed this minor change.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-29 16:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23  4:54 Documentation vs. implementation for org-properties-postprocess-alist Bill Wishon
2012-04-29  9:43 ` Bastien
2012-04-29 15:50   ` Bill Wishon
2012-04-29 16:07     ` Bastien

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).