forked from mirrors/org-mode
org-clock-out-removed-last-clock: New variable to be used by `org-clock-hook'
* lisp/org-clock.el (org-clock-out-removed-last-clock): Add new global variable. (org-clock-out): Set the variable to non-nil when the CLOCK line has been removed before running `org-clock-out-hook'. (org-clock-out-hook): Add reference to the new variable. * etc/ORG-NEWS (New variable ~org-clock-out-removed-last-clock~): Announce the change.
This commit is contained in:
parent
9512bf250a
commit
2b15e789ae
|
@ -308,6 +308,13 @@ The change is breaking when ~org-use-property-inheritance~ is set to ~t~.
|
|||
|
||||
The =TEST= parameter is better served by Emacs debugging tools.
|
||||
** New and changed options
|
||||
*** New variable ~org-clock-out-removed-last-clock~
|
||||
|
||||
The variable is intended to be used by ~org-clock-out-hook~. It is a
|
||||
flag used to signal when the =CLOCK= line has been removed. This can
|
||||
happen when ~org-clock-out-remove-zero-time-clocks~ is customized to
|
||||
be non-nil.
|
||||
|
||||
*** ~org-info-other-documents~ is now a custom option
|
||||
|
||||
Users can now extend the value of ~org-info-other-documents~ to
|
||||
|
|
|
@ -515,7 +515,10 @@ to add an effort property.")
|
|||
"Hook run when starting the clock.")
|
||||
(defvar org-clock-out-hook nil
|
||||
"Hook run when stopping the current clock.
|
||||
The point is at the current clock line when the hook is executed.")
|
||||
The point is at the current clock line when the hook is executed.
|
||||
|
||||
The hook functions can access `org-clock-out-removed-last-clock' to
|
||||
check whether the latest CLOCK line has been cleared.")
|
||||
|
||||
(defvar org-clock-cancel-hook nil
|
||||
"Hook run when canceling the current clock.")
|
||||
|
@ -1698,6 +1701,11 @@ and current `frame-title-format' is equal to `org-clock-frame-title-format'."
|
|||
(equal frame-title-format org-clock-frame-title-format))
|
||||
(setq frame-title-format org-frame-title-format-backup)))
|
||||
|
||||
(defvar org-clock-out-removed-last-clock nil
|
||||
"When non-nil, the last `org-clock-out' removed the clock line.
|
||||
This can happen when `org-clock-out-remove-zero-time-clocks' is set to
|
||||
non-nil and the latest clock took 0 minutes.")
|
||||
|
||||
;;;###autoload
|
||||
(defun org-clock-out (&optional switch-to-state fail-quietly at-time)
|
||||
"Stop the currently running clock.
|
||||
|
@ -1788,6 +1796,7 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
|
|||
te (org-duration-from-minutes (+ (* 60 h) m)))
|
||||
(unless (org-clocking-p)
|
||||
(setq org-clock-current-task nil))
|
||||
(setq org-clock-out-removed-last-clock remove)
|
||||
(run-hooks 'org-clock-out-hook)
|
||||
;; Add a note, but only if we didn't remove the clock line.
|
||||
(when (and org-log-note-clock-out (not remove))
|
||||
|
|
Loading…
Reference in New Issue