emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] make quarter work as parameter for :step in clocktable


From: Joost Helberg
Subject: [PATCH] make quarter work as parameter for :step in clocktable
Date: Tue, 05 Oct 2021 09:26:39 +0200
User-agent: mu4e 1.5.11; emacs 27.1

Hi,

many years ago a colleague and myself wrote a patch for quarters into
org-mode/clocktable for blocks, today I noticed that :step should allow
'quarter' as an argument too. Here's the tiny patch to allow that:

---
 doc/org-manual.org | 2 +-
 lisp/org-clock.el  | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index b25da7889..133d880c7 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -6738,7 +6738,7 @@ be selected:
 
 - =:step= ::
 
-  Set to =day=, =week=, =semimonth=, =month=, or =year= to split the
+  Set to =day=, =week=, =semimonth=, =month=, =quarter=, or =year= to split the
   table into chunks.  To use this, either =:block=, or =:tstart= and
   =:tend= are required.
 
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 143ed4f12..4628d4b5f 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2822,6 +2822,7 @@ a number of clock tables."
             (`semimonth "Semimonthly report starting on: ")
             (`month "Monthly report starting on: ")
             (`year "Annual report starting on: ")
+            (`quarter "Quarterly report starting on: ")
             (_ (user-error "Unknown `:step' specification: %S" step))))
          (week-start (or (plist-get params :wstart) 1))
          (month-start (or (plist-get params :mstart) 1))
@@ -2873,7 +2874,8 @@ a number of clock tables."
                                            (if (< d 16) 16 1)
                                            (if (< d 16) m (1+ m)) y))
                          (`month (list 0 0 0 month-start (1+ m) y))
-                         (`year (list 0 0 org-extend-today-until 1 1 (1+ 
y)))))))
+                         (`year (list 0 0 org-extend-today-until 1 1 (1+ y)))
+                         (`quarter (list 0 0 0 month-start (+ 3 m) y))))))
              (table-begin (line-beginning-position 0))
             (step-time
               ;; Write clock table between START and NEXT.
-- 
2.25.1

-- 
Cistus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]