From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Org Mode List <emacs-orgmode@gnu.org>
Subject: [ANN] Small improvements in Columns view
Date: Thu, 25 Feb 2016 01:07:41 +0100 [thread overview]
Message-ID: <87a8mp4ppu.fsf@nicolasgoaziou.fr> (raw)
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
reply other threads:[~2016-02-25 0:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8mp4ppu.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.