summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-02-14 18:00:38 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-02-14 18:00:38 +0100
commitaf824a9b397d72edb6577990e7c45c7ffd2064ef (patch)
tree2108a24e74e57719679182c0db436b089bfc81b5
parent269ccd9590c88074aae19c37defb9d806f27a29a (diff)
parent1a5151c51d3f3118e19f732ae364c7b01921af7c (diff)
downloadorg-mode-af824a9b397d72edb6577990e7c45c7ffd2064ef.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-clock.el37
1 files changed, 21 insertions, 16 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index ec7f49c..2dc776e 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2022,27 +2022,32 @@ fontified, and then returned."
;;;###autoload
(defun org-clock-report (&optional arg)
- "Create a table containing a report about clocked time.
-If the cursor is inside an existing clocktable block, then the table
-will be updated. If not, a new clocktable will be inserted. The scope
-of the new clock will be subtree when called from within a subtree, and
-file elsewhere.
-
-When called with a prefix argument, move to the first clock table in the
-buffer and update it."
+ "Update or create a table containing a report about clocked time.
+
+If point is inside an existing clocktable block, update it.
+Otherwise, insert a new one.
+
+The new table inherits its properties from the variable
+`org-clock-clocktable-default-properties'. The scope of the
+clocktable, when not specified in the previous variable, is
+`subtree' when the function is called from within a subtree, and
+`file' elsewhere.
+
+When called with a prefix argument, move to the first clock table
+in the buffer and update it."
(interactive "P")
(org-clock-remove-overlays)
(when arg
(org-find-dblock "clocktable")
(org-show-entry))
- (if (org-in-clocktable-p)
- (goto-char (org-in-clocktable-p))
- (let ((props (if (ignore-errors
- (save-excursion (org-back-to-heading)))
- (list :name "clocktable" :scope 'subtree)
- (list :name "clocktable"))))
- (org-create-dblock
- (org-combine-plists org-clock-clocktable-default-properties props))))
+ (pcase (org-in-clocktable-p)
+ (`nil
+ (org-create-dblock
+ (org-combine-plists
+ (list :scope (if (org-before-first-heading-p) 'file 'subtree))
+ org-clock-clocktable-default-properties
+ '(:name "clocktable"))))
+ (start (goto-char start)))
(org-update-dblock))
(defun org-day-of-week (day month year)