Sometimes when we use "clock in" command in org mode and forget to clock out before exit emacs. When we open emacs again and try to "clock in" with the same entry. There always popup with something for us to choose. Does there exists some command to reminds us to clock out when we exits emacs or just choose "clock out" when we exit emacs?
I use the following in my init file to solve exactly this problem. I probably cribbed this from somewhere myself but it's been so long I can't remember the source.
(defun my/org-clock-query-out () "Ask the user before clocking out. This is a useful function for adding to `kill-emacs-query-functions'." (if (and (featurep 'org-clock) (funcall 'org-clocking-p) (y-or-n-p "You are currently clocking time, clock out? ")) (org-clock-out) t)) ;; only fails on keyboard quit or error ;; timeclock.el puts this on the wrong hook! (add-hook 'kill-emacs-query-functions 'my/org-clock-query-out)
If you really want to do it, it can be done.
There are two standard hooks that you can use when emacs exits:
kill-emacs-query-functions. The former is simple to use for always clocking out when you exit emacs:
(add-hook 'kill-emacs-hook #'org-clock-out)
List of standard hooks: https://www.gnu.org/software/emacs/manual/html_node/elisp/Standard-Hooks.html