emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] make quarter work as parameter for :step in clocktable
@ 2021-10-05  7:26 Joost Helberg
  0 siblings, 0 replies; only message in thread
From: Joost Helberg @ 2021-10-05  7:26 UTC (permalink / raw)
  To: emacs-orgmode

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-05 12:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05  7:26 [PATCH] make quarter work as parameter for :step in clocktable Joost Helberg

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).