From 7f77be429b0c76bd989e30f22092807b87dec17f Mon Sep 17 00:00:00 2001 From: Blake Romero Date: Fri, 11 Jul 2025 14:58:52 +0100 Subject: Add clock table settings --- emacs-config.org | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/emacs-config.org b/emacs-config.org index 410feaa..6bf800f 100644 --- a/emacs-config.org +++ b/emacs-config.org @@ -366,7 +366,7 @@ Case-sensitive search by default and show match count in minibuffer. <>) #+end_src -#+begin_src elisp +#+begin_src elisp :noweb yes (with-eval-after-load 'org-agenda <>) #+end_src @@ -718,6 +718,51 @@ Set time grid. "⏰" "——————————————————————————————")) #+end_src +** Org Clock-table +Define a custom clocktable formatter function for ~+org-clocktable-format~. +#+begin_src elisp + (with-eval-after-load 'org-clock + (defun +org-clocktable-format (&rest args) + "A cleaner Org clocktable format." + (apply #'org-clocktable-write-default args) + (save-excursion + ;; Rename headline + (search-forward "Headline") + (backward-kill-sexp) + (insert "Tasks") + (org-table-align) + + ;; Capitalise row + (beginning-of-line) + (setq this-command-keys-shift-translated t) + (call-interactively 'end-of-line) + (call-interactively 'capitalize-dwim) + (deactivate-mark) + + ;; Remove cookies + (org-mark-element) + (while (re-search-forward + "\\[[0-9]+\\(?:/[0-9]\\|%\\)\\] " nil t) + (replace-match "")) + (org-table-align) + (exchange-point-and-mark t) + + ;; Move total time row to the end of the table + (kill-whole-line) + (condition-case nil + (while t + (org-table-move-row-down)) + (error nil)) + (org-table-insert-hline t)))) +#+end_src + +Set default clocktable parameters. +#+begin_src elisp :tangle no :noweb-ref org-agenda-settings + (setq-default + org-agenda-clockreport-parameter-plist + '(:link t :fileskip0 t :hidefiles t :formatter +org-clocktable-format)) +#+end_src + ** Error Checking Enable flymake for programming modes. #+begin_src elisp -- cgit