summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien <bzg@gnu.org>2020-02-09 11:17:42 +0100
committerBastien <bzg@gnu.org>2020-02-09 11:17:42 +0100
commita62751a6a54a214d9582937c7d155f1d321cd5c4 (patch)
tree2b5bcc12210494fbb78a148381c91b4a3d9b8224
parent88794cab064037b223ba75b153f7ae54736543c6 (diff)
downloadorg-mode-a62751a6a54a214d9582937c7d155f1d321cd5c4.tar.gz
Add `org-clock-toggle-auto-clockout'
* doc/org-manual.org: Document the new command. * lisp/org-clock.el (org-clock-toggle-auto-clockout): New command.
-rw-r--r--doc/org-manual.org3
-rw-r--r--lisp/org-clock.el9
2 files changed, 12 insertions, 0 deletions
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 985c9d4..f2784d4 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -6901,6 +6901,9 @@ set ~org-clock-auto-clockout-timer~ to a number of seconds and add
When the clock is running and Emacs is idle for more than this number
of seconds, the clock will be clocked out automatically.
+Use =M-x org-clock-toggle-auto-clockout RET= to temporarily turn this
+on or off.
+
** Effort Estimates
:PROPERTIES:
:DESCRIPTION: Planning work effort in advance.
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index b648ca2..75027e6 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1422,6 +1422,15 @@ is present in the user configuration."
org-clock-auto-clockout-timer nil #'org-clock-out)))
;;;###autoload
+(defun org-clock-toggle-auto-clockout ()
+ (interactive)
+ (if (memq 'org-clock-auto-clockout org-clock-in-hook)
+ (progn (remove-hook 'org-clock-in-hook #'org-clock-auto-clockout)
+ (message "Auto clock-out after idle time turned off"))
+ (add-hook 'org-clock-in-hook #'org-clock-auto-clockout t)
+ (message "Auto clock-out after idle time turned on")))
+
+;;;###autoload
(defun org-clock-in-last (&optional arg)
"Clock in the last closed clocked item.
When already clocking in, send a warning.