Skip to content

Instantly share code, notes, and snippets.

@stephenwithav
Created November 24, 2013 23:36
Show Gist options
  • Save stephenwithav/7634002 to your computer and use it in GitHub Desktop.
Save stephenwithav/7634002 to your computer and use it in GitHub Desktop.
Code to execute custom hooks before clocking out in org-mode. (save-excursion) fails to return me to the proper screen, e.g., the agenda.
(defvar org-pre-clock-cancel-hook nil
"Hooks to run immediately before canceling a clock.")
(defun rand/org-clock-cancel ()
(interactive)
(save-excursion
(org-clock-goto)
(run-hooks 'org-pre-clock-cancel-hook)
(org-clock-cancel)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment