[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Query when exiting with running clock
From: |
Allen Li |
Subject: |
[PATCH] Query when exiting with running clock |
Date: |
Tue, 12 Jan 2021 00:55:37 -0800 |
This is a patch adding a query function when exiting Emacs, warning the
user if there is a running clock. This is useful for preventing the
user from accidentally leaving dangling clocks. I have had success
using a modified personal version of this code.
My personal version instead prompts the user to clock out and save the
buffer. I didn't use it for the patch because it seems a little hacky
to me; e.g., kill-emacs-query-functions doesn't mention whether
functions can have side effects, and the UI is inconsistent with
save-buffers-kill-emacs. The code for my personal version:
(add-to-list 'kill-emacs-query-functions
(lambda ()
(if (not (org-clocking-p))
t
(if (y-or-n-p "Clock out and save?")
(with-current-buffer (marker-buffer org-clock-marker)
(org-clock-out)
(save-buffer)
t)
(message "Aborting")
nil))))
If there is great demand for this version, I might provide another patch.
I have also attached another patch which deduplicates two identical
functions that I noticed when preparing the first patch.
0001-org-clock-Replace-org-clocking-buffer-with-org-clock.patch
Description: Text Data
0002-org-clock-Query-when-exiting-with-running-clock.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Query when exiting with running clock,
Allen Li <=