emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samim Pezeshki <p.samim@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] lisp/org-agenda.el: Add header to agenda clock report table
Date: Mon, 10 Jan 2022 12:56:49 +0330	[thread overview]
Message-ID: <CAJAdVc06_tj58Je=tn42JqfUtkjamQBQdcvobQXeegARS_M0hQ@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 128 bytes --]

Hi,

This patch adds a header to the clock report table in the agenda, if
org-agenda-clock-report-header is set.

Thanks,
Samim

[-- Attachment #1.2: Type: text/html, Size: 865 bytes --]

[-- Attachment #2: 0001-lisp-org-agenda.el-Add-header-to-agenda-clock-report.patch --]
[-- Type: text/x-patch, Size: 2777 bytes --]

From 36bc298c1820003cd2a9370bc36c21efe667e7b4 Mon Sep 17 00:00:00 2001
From: Samim Pezeshki <psamim@gmail.com>
Date: Mon, 10 Jan 2022 12:32:51 +0330
Subject: [PATCH] lisp/org-agenda.el: Add header to agenda clock report table

* lisp/org-agenda.el (org-agenda-list): Add header to agenda
clock report table.

TINYCHANGE
---
 doc/org-manual.org | 4 ++--
 etc/ORG-NEWS       | 1 +
 lisp/org-agenda.el | 9 +++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index b4c20f252..2c54fde87 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -9742,8 +9742,8 @@ the other commands, point needs to be in the desired line.
   variable ~org-agenda-start-with-clockreport-mode~.  By using
   a prefix argument when toggling this mode (i.e., {{{kbd(C-u R)}}}),
   the clock table does not show contributions from entries that are
-  hidden by agenda filtering[fn:99].  See also the variable
-  ~org-clock-report-include-clocking-task~.
+  hidden by agenda filtering[fn:99].  See also the variables
+  ~org-clock-report-include-clocking-task~ and ~org-agenda-clock-report-header~.
 
 - {{{kbd(v c)}}} ::
 
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 335db4139..5a94e737e 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -140,6 +140,7 @@ introduced which will accept three new formats:
 Chmod-style permissions are based on the new variable
 ~org-babel-tangle-default-file-mode~.
 
+*** A new custom setting =org-agenda-clock-report-header= to add a header to org agenda clock report
 * Version 9.5
 
 ** Important announcements and breaking changes
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 7bcaf7117..be0808e45 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1217,6 +1217,11 @@ For example, 9:30am would become 09:30 rather than  9:30."
   :version "24.1"
   :type 'boolean)
 
+(defcustom org-agenda-clock-report-header nil
+  "Header for org agenda clock report mode"
+  :group 'org-agenda
+  :type 'string)
+
 (defun org-agenda-time-of-day-to-ampm (time)
   "Convert TIME of a string like \"13:45\" to an AM/PM style time string."
   (let* ((hour-number (string-to-number (substring time 0 -3)))
@@ -4473,6 +4478,10 @@ items if they have an hour specification like [h]h:mm."
 	  (setq p (plist-put p :tend clocktable-end))
 	  (setq p (plist-put p :scope 'agenda))
 	  (setq tbl (apply #'org-clock-get-clocktable p))
+    (when org-agenda-clock-report-header
+      (put-text-property 0 (length org-agenda-clock-report-header) 'face 'org-agenda-structure
+                         org-agenda-clock-report-header)
+      (insert org-agenda-clock-report-header))
 	  (insert tbl)))
       (goto-char (point-min))
       (or org-agenda-multi (org-agenda-fit-window-to-buffer))
-- 
2.34.1


             reply	other threads:[~2022-01-10  9:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10  9:26 Samim Pezeshki [this message]
2022-01-10 10:27 ` [PATCH] lisp/org-agenda.el: Add header to agenda clock report table Christopher M. Miles
2022-01-21  9:13   ` Samim Pezeshki
2022-01-21 10:28 ` Nicolas Goaziou
2022-01-22 16:24   ` Samim Pezeshki
2022-01-26 20:08     ` Nicolas Goaziou
2022-01-28  9:01     ` [ISSUE] " Christopher M. Miles
2022-05-09 12:38       ` [PATCH] " Ihor Radchenko
2022-07-11  5:03         ` 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='CAJAdVc06_tj58Je=tn42JqfUtkjamQBQdcvobQXeegARS_M0hQ@mail.gmail.com' \
    --to=p.samim@gmail.com \
    --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).