From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stig Brautaset Subject: Re: Conditional summing in column-mode? Date: Mon, 28 Aug 2017 11:41:01 +0100 Message-ID: References: <87bmn4ytce.fsf@nicolasgoaziou.fr> <87shgfxvzr.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmHTc-0002yN-CC for emacs-orgmode@gnu.org; Mon, 28 Aug 2017 06:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmHTZ-00040t-9y for emacs-orgmode@gnu.org; Mon, 28 Aug 2017 06:41:04 -0400 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:32913) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dmHTZ-0003zO-2p for emacs-orgmode@gnu.org; Mon, 28 Aug 2017 06:41:01 -0400 In-reply-to: <87shgfxvzr.fsf@nicolasgoaziou.fr> 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" To: Nicolas Goaziou Cc: emacs-org list Nicolas Goaziou writes: > Stig Brautaset 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