emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Joost Helberg <joost@cistus.nl>
To: emacs-orgmode@gnu.org
Subject: [PATCH] make quarter work as parameter for :step in clocktable
Date: Tue, 05 Oct 2021 09:26:39 +0200	[thread overview]
Message-ID: <874k9w0w1t.fsf@cistus.nl> (raw)

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	other threads:[~2021-10-05 12:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05  7:26 Joost Helberg [this message]
2022-09-09 13:20 ` [PATCH] make quarter work as parameter for :step in clocktable Ihor Radchenko

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874k9w0w1t.fsf@cistus.nl \
    --to=joost@cistus.nl \
    --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 public 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).