From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: [ANN] Small improvements in Columns view Date: Thu, 25 Feb 2016 01:07:41 +0100 Message-ID: <87a8mp4ppu.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYjRA-00023n-KW for emacs-orgmode@gnu.org; Wed, 24 Feb 2016 19:05:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYjR5-0006xX-Js for emacs-orgmode@gnu.org; Wed, 24 Feb 2016 19:05:44 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:48295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYjR5-0006ww-7H for emacs-orgmode@gnu.org; Wed, 24 Feb 2016 19:05:39 -0500 Received: from selenimh (unknown [IPv6:2a03:a0a0:0:4301::2de]) (Authenticated sender: mail@nicolasgoaziou.fr) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 4B87D172094 for ; Thu, 25 Feb 2016 01:05:37 +0100 (CET) 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: Org Mode List Hello, It is now possible to use custom summaries in Columns view, and re-use the same property in multiple columns. In the latter situation, the first columns referencing the property determines how the values for that property are to be computed. The following example illustrates these features: (defun my-Med (values printf) (let ((v (sort (mapcar #'string-to-number values) #'<)) (l (length values))) (number-to-string (if (= (% l 2) 1) (nth (floor l 2) v) (let ((m (/ l 2))) (/ (+ (nth m v) (nth (1+ m) v)) 2.0)))))) (defun my-Q1 (values printf) (number-to-string (nth (floor (length values) 4) (sort (mapcar #'string-to-number values) #'<)))) (defun my-Q3 (values printf) (number-to-string (nth (floor (* (length values) 0.75)) (sort (mapcar #'string-to-number values) #'<)))) (add-to-list 'org-columns-summary-types '("Med" . my-Med)) (add-to-list 'org-columns-summary-types '("Q1" . my-Q1)) (add-to-list 'org-columns-summary-types '("Q3" . my-Q3)) #+COLUMNS: %ITEM %VALUE(Min){min} %VALUE(Q1){Q1} %VALUE(Med){Med} %VALUE(Q3){Q3} %VALUE(Max){max} * H ** S1 :PROPERTIES: :VALUE: 2 :END: ** S2 :PROPERTIES: :VALUE: 1 :END: ** S3 :PROPERTIES: :VALUE: 9 :END: ** S4 :PROPERTIES: :VALUE: 7 :END: Feedback welcome. Regards, -- Nicolas Goaziou 0x80A93738