Compare commits

...

3 Commits

Author SHA1 Message Date
d1e3409e80
Only search for parent task for clock continuation when necessary
Avoid unnessary work by leveraging the fact that `setq` returns the new
value of the variable being set :D
2023-12-08 17:45:10 +01:00
498f4b78c4
Automatically clock into interrupted task only when not closed yet
This is to avoid jumping back to old task that are still pointed at by
`org-clock-interrupted-task` that have long been closed.  Let's see
whether this is enough to handle this case.
2023-12-08 17:43:59 +01:00
7128144ee0
Fix errors in some docstrings 2023-12-08 17:27:29 +01:00

View File

@ -424,19 +424,26 @@ should not be clocked."
This functions tries to clock into the interrupted task, the
parent task, or the default task, in that order and only when
available, respectively. If none of these tasks is available,
interactively query the user for the next task to clock into."
available, respectively. Clock in to the interrupted task only
if it is not closed yet.
If none of the listed tasks is available, interactively query the
user for the next task to clock into."
(when (and (not org-clock-clocking-in)
(not org-clock-resolving-clocks-due-to-idleness))
(let ((parent-task (db/find-parent-task)))
(let (parent-task)
(save-mark-and-excursion
(cond
((and (markerp org-clock-interrupted-task)
(marker-buffer org-clock-interrupted-task))
;; interrupted task is set
(marker-buffer org-clock-interrupted-task)
(org-with-point-at org-clock-interrupted-task
(not (member (nth 2 (org-heading-components))
org-done-keywords))))
;; interrupted task is set and not closed yet, so let's clock in
;; there
(org-with-point-at org-clock-interrupted-task
(org-clock-in)))
(parent-task
((setq parent-task (db/find-parent-task))
;; found parent task
(org-with-point-at parent-task
(org-clock-in)))
@ -466,7 +473,7 @@ interactively query the user for the next task to clock into."
(modify-frame-parameters frame `((name . ,org-clock-heading)))))))
(defun db/show-current-org-task ()
"Show title of currently clock in task in modeline."
"Show title of currently clock in task in minibuffer."
(interactive)
(message org-clock-current-task))
@ -816,10 +823,11 @@ PARAMS is a property list of the following parameters:
(defun db/org-clock-in-last-task (&optional arg)
;; from doc.norang.ca, originally bh/clock-in-last-task
"Clock in the interrupted task if there is one.
"Clock into the last task from the clocking history.
Skip the default task and get the next one. If ARG is given,
forces clocking in of the default task."
Skip the default task if it's at the top of the clocking history,
and get the next one. If ARG is given, forces clocking in of the
default task, though."
(interactive "p")
(let ((clock-in-to-task
(cond