Run some hooks when punching in and out with timekeep

This commit is contained in:
Chris Barrett
2022-10-06 19:07:14 +13:00
parent 0a51c63076
commit 0ac9712447

View File

@ -119,6 +119,16 @@ Will be used if:
:group 'timekeep :group 'timekeep
:type 'hook) :type 'hook)
(defcustom timekeep-punched-in-hook nil
"Hook run after punching in."
:group 'timekeep
:type 'hook)
(defcustom timekeep-punched-out-hook nil
"Hook run after punching out."
:group 'timekeep
:type 'hook)
(defcustom timekeep-node-to-name-function #'org-roam-node-title (defcustom timekeep-node-to-name-function #'org-roam-node-title
"Function taking an `org-roam-node' and returning a company or cilent's name." "Function taking an `org-roam-node' and returning a company or cilent's name."
:group 'timekeep :group 'timekeep
@ -334,6 +344,8 @@ on the default headline for that client."
'(4))) '(4)))
(error (timekeep--clock-in-on-default))))) (error (timekeep--clock-in-on-default)))))
(run-hooks 'timekeep-punched-in-hook)
(when (derived-mode-p 'org-agenda-mode) (when (derived-mode-p 'org-agenda-mode)
;; Swap agenda due to context change. ;; Swap agenda due to context change.
(run-hooks 'timekeep-agenda-should-update-hook))) (run-hooks 'timekeep-agenda-should-update-hook)))
@ -347,6 +359,9 @@ on the default headline for that client."
(org-clock-out)) (org-clock-out))
(org-agenda-remove-restriction-lock) (org-agenda-remove-restriction-lock)
(org-save-all-org-buffers) (org-save-all-org-buffers)
(run-hooks 'timekeep-punched-out-hook)
(when (derived-mode-p 'org-agenda-mode) (when (derived-mode-p 'org-agenda-mode)
;; Swap agenda due to context change. ;; Swap agenda due to context change.
(run-hooks 'timekeep-agenda-should-update-hook)) (run-hooks 'timekeep-agenda-should-update-hook))