From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA. Date: Sat, 18 Jul 2009 11:35:48 +0200 Message-ID: <87ws66jpu3.fsf@bzg.ath.cx> References: <1247473682-23338-1-git-send-email-ahktenzero@mohorovi.cc> <1247473682-23338-2-git-send-email-ahktenzero@mohorovi.cc> <87zlb344so.fsf@bzg.ath.cx> <20090717182243.GB15275@yog-sothoth.mohorovi.cc> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MS6Kt-0005uZ-OH for emacs-orgmode@gnu.org; Sat, 18 Jul 2009 05:36:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MS6Ko-0005sD-Lb for emacs-orgmode@gnu.org; Sat, 18 Jul 2009 05:36:06 -0400 Received: from [199.232.76.173] (port=51462 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MS6Ko-0005rt-8m for emacs-orgmode@gnu.org; Sat, 18 Jul 2009 05:36:02 -0400 Received: from rv-out-0708.google.com ([209.85.198.251]:38957) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MS6Kn-0000il-SN for emacs-orgmode@gnu.org; Sat, 18 Jul 2009 05:36:02 -0400 Received: by rv-out-0708.google.com with SMTP id c5so291622rvf.2 for ; Sat, 18 Jul 2009 02:36:00 -0700 (PDT) In-Reply-To: <20090717182243.GB15275@yog-sothoth.mohorovi.cc> (James TD Smith's message of "Fri, 17 Jul 2009 19:22:43 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: James TD Smith Cc: emacs-orgmode@gnu.org --=-=-= Hi James, this small patch against current org-colview.el lets you have a custom function for computing a "summary" of a property and displaying it in the column. To compute the time since the timestamp, you can use this patch and some of your code like this: --8<---------------cut here---------------start------------->8--- (setq org-columns-custom-summary-function 'my-org-compute-since) (defun org-time-since (time) "Get the number of days since `time'" (time-to-number-of-days (time-since (apply 'encode-time (org-parse-time-string time))))) (defun my-org-compute-since (&rest values) "Eval elapsted days since the entry's timestamp." (let* ((ts (org-entry-get (point) "TIMESTAMP"))) (when ts (org-time-since ts)))) --8<---------------cut here---------------end--------------->8--- This patch is just a workaround, though. I think we should have a way of adding more than one custom function, as Mikael Fornius suggested when sending his first patch. Let's see what's Carsten take on this. Thanks! --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org-colview.el.patch diff --git a/lisp/org-colview.el b/lisp/org-colview.el index d132bf6..b312d35 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -698,20 +698,30 @@ around it." (org-columns-display-here (cdr x))) cache))))) +(defcustom org-columns-custom-summary-function nil + "A user-defined custom summary function. +This function takes one argument: a list containing the values of +all children for the summarized property. This function should +return a number." + :group 'org-link + :type 'function) + (defvar org-columns-compile-map - '(("none" none +) - (":" add_times +) - ("+" add_numbers +) - ("$" currency +) - ("X" checkbox +) - ("X/" checkbox-n-of-m +) - ("X%" checkbox-percent +) - ("max" max_numbers max) - ("min" min_numbers min) - ("mean" mean_numbers (lambda (&rest x) (/ (apply '+ x) (float (length x))))) - (":max" max_times max) - (":min" min_times min) - (":mean" mean_times (lambda (&rest x) (/ (apply '+ x) (float (length x)))))) + '(("none" none +) + (":" add_times +) + ("+" add_numbers +) + ("$" currency +) + ("X" checkbox +) + ("X/" checkbox-n-of-m +) + ("X%" checkbox-percent +) + ("max" max_numbers max) + ("min" min_numbers min) + ("mean" mean_numbers (lambda (&rest x) (/ (apply '+ x) (float (length x))))) + (":max" max_times max) + (":min" min_times min) + (":mean" mean_times (lambda (&rest x) (/ (apply '+ x) (float (length x))))) + ("custom" custom_function (lambda (&rest x) + (funcall org-columns-custom-summary-function x)))) "Operator <-> format,function map. Used to compile/uncompile columns format and completing read in interactive function org-columns-new.") --=-=-= -- Bastien --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--