emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Conditional summing in column-mode?


From: Stig Brautaset
Subject: Re: [O] Conditional summing in column-mode?
Date: Mon, 28 Aug 2017 11:41:01 +0100
User-agent: mu4e 0.9.19; emacs 26.0.50

Nicolas Goaziou <address@hidden> writes:

> Stig Brautaset <address@hidden> writes:
>
>> However, I would like to add an advice around =org-columns-compute-all=
>> to run the =sb/org-map-confirmed-days= function, and this I have not
>> been successful at. I've tried doing this:
>>
>> : (add-function :before org-columns-compute-all #'sb/org-map-confirmed-days)
>>
>> However, I keep getting the following error:
>>
>> : Use of gv-ref probably requires lexical-binding
>> : advice--add-function: Symbol’s value as variable is void: 
>> org-columns-compute-all
>>
>> I would appreciate if anyone has any insight into solving this.
>
> Not really your question but since you can define your own summary
> function (see `org-columns-summary-types'), just make sure the summary
> function first refreshes the new property in headlines below the node
> you're currently summarizing.

Thanks! This _almost_ works:

,----
| (defun sb/org-columns--summary-sum (values printf)
|   (org-map-entries #'sb/org-calc-confirmed-days nil 'tree)
|   (org-columns--summary-sum values printf))
|
| (setq org-columns-summary-types
|       '(("X+" . sb/org-columns--summary-sum)))
`----

Unfortunately it doesn't quite: the functions in
=org-columns-summary-types= are passed a list of values already
extracted from the properties, so my calculation of "confirmed days"
only takes effect on the _next_ call to the summary function. Is there a
hook I can use that is called before the property values are extracted?
(I wasn't able to find one.)

Stig



reply via email to

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