[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 9aa9f3b 6/6: org-clock.el: clocktable ':formula %'
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 9aa9f3b 6/6: org-clock.el: clocktable ':formula %' now includes per-file time pct |
Date: |
Sat, 1 May 2021 05:57:13 -0400 (EDT) |
branch: externals/org
commit 9aa9f3b1f7291a7a94342530f71086bd3084bcb1
Author: Alan D. Salewski <ads@salewski.email>
Commit: Bastien Guerry <bzg@gnu.org>
org-clock.el: clocktable ':formula %' now includes per-file time pct
* lisp/org-clock.el (org-clocktable-write-default): When ':formula %'
is in-effect, show the per-file time percentage in the '%' column.
TINYCHANGE
This change only has an effect when multiple files are contributing to
a given clocktable (such as when ':scope agenda' has been specified).
The existing behavior is that such tables have an extra 'File' column,
and each individual file that contributes has its own summary line
with the headline value '*File time*'. Those summary rows also
produce a rollup time value for the file in the 'Time' column.
Prior to this change, the built-in '%' formula does not produce a
calculation for those per-file times in the '%' column (the relevant
cells in the '%' column were blank). With this change, the percentage
contribution of each individual file time to the total time is shown.
The more agenda files you have, the more useful this behavior becomes.
Signed-off-by: Alan D. Salewski <ads@salewski.email>
---
lisp/org-clock.el | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 2fc7b0d..0d0efcc 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2702,7 +2702,18 @@ from the dynamic block definition."
(format (concat "| %s %s | %s%s%s"
(format org-clock-file-time-cell-format
(org-clock--translate "File time" lang))
- " | *%s*|\n")
+
+ ;; The file-time rollup value goes in the first
time
+ ;; column (of which there is always at least
one)...
+ " | *%s*|"
+ ;; ...and the remaining file time cols (if any)
are blank.
+ (make-string (max 0 (1- time-columns)) ?|)
+
+ ;; Optionally show the percentage contribution of
"this"
+ ;; file time to the total time.
+ (if (eq formula '%) " %s |" "")
+ "\n")
+
(file-name-nondirectory file-name)
(if level? "| " "") ;level column, maybe
(if timestamp "| " "") ;timestamp column, maybe
@@ -2710,7 +2721,12 @@ from the dynamic block definition."
(if properties ;properties columns, maybe
(make-string (length properties) ?|)
"")
- (org-duration-from-minutes file-time)))) ;time
+ (org-duration-from-minutes file-time) ;time
+
+ (cond ((not (eq formula '%)) "") ;time percentage,
maybe
+ ((or (not total-time) (= total-time 0)) "0.0")
+ (t
+ (format "%.1f" (* 100 (/ file-time (float
total-time)))))))))
;; Get the list of node entries and iterate over it
(when (> maxlevel 0)
- [elpa] externals/org updated (7c99d15 -> 9aa9f3b), ELPA Syncer, 2021/05/01
- [elpa] externals/org 7c9bf39 3/6: lisp/ox-html.el (org-html-scripts): Small refactoring, ELPA Syncer, 2021/05/01
- [elpa] externals/org f9bed1c 4/6: Merge branch 'maint', ELPA Syncer, 2021/05/01
- [elpa] externals/org 7da20ff 1/6: lisp/ob-plantuml.el: New option `org-babel-plantuml-svg-text-to-path', ELPA Syncer, 2021/05/01
- [elpa] externals/org 2d1d59d 2/6: etc/ORG-NEWS: Advertize `org-babel-plantuml-svg-text-to-path', ELPA Syncer, 2021/05/01
- [elpa] externals/org 9aa9f3b 6/6: org-clock.el: clocktable ':formula %' now includes per-file time pct,
ELPA Syncer <=
- [elpa] externals/org bb24248 5/6: lisp/ox-html.el: Set `org-html-head-include-scripts' to nil, ELPA Syncer, 2021/05/01