dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit dccb003b6b37ca74bde61961255f2f09d141ac74
parent 5433105a2533ac40d3dfebbbc6104b76c49380cd
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Mon, 27 Jan 2025 02:18:28 +0100

emacs: misc things

Diffstat:
Memacs/config.org | 5++++-
Memacs/jokull-theme.el | 1+
Aemacs/lisp/org-clock-override.el | 43+++++++++++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/emacs/config.org b/emacs/config.org @@ -1852,6 +1852,9 @@ Install Org and require additional components that I use. ;; Improved search (use-package org-ql) + ;; My override for org clock resolve + (require 'org-clock-override) + ;; Tempo expansions (add-to-list 'org-structure-template-alist '("se" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("sb" . "src bibtex")) @@ -2038,7 +2041,7 @@ Templates for quick capture: ("s" "Save for read/watch/listen" entry (file+headline ,za/org-life-someday "Read/watch/listen") - "* TODO %?[[%^{link}][%^{description}]] %^G")))) + "* %?[[%^{link}][%^{description}]] %^g")))) #+end_src *** Todo & custom agenda views diff --git a/emacs/jokull-theme.el b/emacs/jokull-theme.el @@ -90,6 +90,7 @@ `(org-level-3 ((,class (:bold t :foreground ,fg4)))) `(org-level-4 ((,class (:bold nil :foreground ,fg4)))) `(org-date ((,class (:underline t :foreground ,var) ))) + `(org-list-dt ((,class (:inherit default)))) `(org-drawer ((,class (:foreground "#7d7d7d" :slant italic)))) `(org-footnote ((,class (:underline t :foreground ,fg4)))) `(org-link ((,class (:underline t :foreground ,type )))) diff --git a/emacs/lisp/org-clock-override.el b/emacs/lisp/org-clock-override.el @@ -0,0 +1,43 @@ +(defun za/org-clock-resolve-clock + (clock resolve-to clock-out-time close restart fail-quietly) + "Resolve CLOCK given the time RESOLVE-TO, and the present. +CLOCK is a cons cell of the form (MARKER START-TIME)." + (let ((org-clock-resolving-clocks t) + ;; If the clocked entry contained only a clock and possibly + ;; the associated drawer, and we either cancel it or clock it + ;; out, `org-clock-out-remove-zero-time-clocks' may clear all + ;; contents, and leave point on the /next/ headline. We store + ;; the current entry location to be able to get back here when + ;; we need to clock in again the previously clocked task. + (heading (org-with-point-at (car clock) + (org-back-to-heading t) + (point-marker)))) + (pcase resolve-to + (`nil + (org-clock-clock-cancel clock) + (when (and restart (not org-clock-clocking-in)) + (org-with-point-at heading (org-clock-in)))) + (`now + (cond + (restart (error "RESTART is not valid here")) + ((or close org-clock-clocking-in) + (org-clock-clock-out clock fail-quietly)) + ((org-is-active-clock clock) nil) + (t (org-clock-clock-in clock t)))) + ((pred (time-less-p nil)) + (error "RESOLVE-TO must refer to a time in the past")) + (_ + (when restart (error "RESTART is not valid here")) + ;; I switched the or condition here because i want G to work the way I want + (org-clock-clock-out clock fail-quietly (or resolve-to clock-out-time)) + (cond + (org-clock-clocking-in nil) + (close + (setq org-clock-leftover-time (and (null clock-out-time) resolve-to))) + (t + (org-with-point-at heading + (org-clock-in nil (and clock-out-time resolve-to))))))))) + +(advice-add 'org-clock-resolve-clock :override #'za/org-clock-resolve-clock) + +(provide 'org-clock-override)