Rename +org/toggle-clock -> +org/toggle-last-clock
And rewrite it to ask for confirmation before clocking in on the item at point. Without this, it's much harder to see what exactly it's doing.
This commit is contained in:
parent
076cee4e89
commit
12e414be89
4 changed files with 21 additions and 33 deletions
|
@ -140,8 +140,8 @@
|
||||||
(cond ((featurep! :completion ivy) #'ivy-bibtex)
|
(cond ((featurep! :completion ivy) #'ivy-bibtex)
|
||||||
((featurep! :completion helm) #'helm-bibtex)))
|
((featurep! :completion helm) #'helm-bibtex)))
|
||||||
|
|
||||||
:desc "Toggle org-clock" "c" #'+org/toggle-clock
|
:desc "Toggle last org-clock" "c" #'+org/toggle-last-clock
|
||||||
:desc "Cancel org-clock" "C" #'org-clock-cancel
|
:desc "Cancel current org-clock" "C" #'org-clock-cancel
|
||||||
:desc "Open deft" "d" #'deft
|
:desc "Open deft" "d" #'deft
|
||||||
(:when (featurep! :lang org +noter)
|
(:when (featurep! :lang org +noter)
|
||||||
:desc "Org noter" "e" #'org-noter)
|
:desc "Org noter" "e" #'org-noter)
|
||||||
|
|
|
@ -477,8 +477,8 @@
|
||||||
(cond ((featurep! :completion ivy) #'ivy-bibtex)
|
(cond ((featurep! :completion ivy) #'ivy-bibtex)
|
||||||
((featurep! :completion helm) #'helm-bibtex)))
|
((featurep! :completion helm) #'helm-bibtex)))
|
||||||
|
|
||||||
:desc "Toggle org-clock" "c" #'+org/toggle-clock
|
:desc "Toggle last org-clock" "c" #'+org/toggle-last-clock
|
||||||
:desc "Cancel org-clock" "C" #'org-clock-cancel
|
:desc "Cancel current org-clock" "C" #'org-clock-cancel
|
||||||
:desc "Open deft" "d" #'deft
|
:desc "Open deft" "d" #'deft
|
||||||
(:when (featurep! :lang org +noter)
|
(:when (featurep! :lang org +noter)
|
||||||
:desc "Org noter" "e" #'org-noter)
|
:desc "Org noter" "e" #'org-noter)
|
||||||
|
|
|
@ -283,37 +283,24 @@ If on a:
|
||||||
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +org/dedent ()
|
(defun +org/toggle-last-clock (arg)
|
||||||
"TODO"
|
"Toggles last clocked item.
|
||||||
(interactive)
|
|
||||||
(cond ((org-at-item-p)
|
|
||||||
(org-list-indent-item-generic
|
|
||||||
-1 nil
|
|
||||||
(save-excursion
|
|
||||||
(when (org-region-active-p)
|
|
||||||
(goto-char (region-beginning)))
|
|
||||||
(org-list-struct))))
|
|
||||||
((org-at-heading-p)
|
|
||||||
(ignore-errors (org-promote)))
|
|
||||||
((call-interactively #'self-insert-command))))
|
|
||||||
|
|
||||||
;;;###autoload
|
Clock out if an active clock is running (or cancel it if prefix ARG is non-nil).
|
||||||
(defun +org/toggle-clock (arg)
|
|
||||||
"Toggles clock on the last clocked item.
|
|
||||||
|
|
||||||
Clock out if an active clock is running. Clock in otherwise.
|
If no clock is active, then clock into the last item. See `org-clock-in-last' to
|
||||||
|
see how ARG affects this command."
|
||||||
If in an org file, clock in on the item at point. Otherwise clock into the last
|
|
||||||
task you clocked into.
|
|
||||||
|
|
||||||
See `org-clock-out', `org-clock-in' and `org-clock-in-last' for details on how
|
|
||||||
the prefix ARG changes this command's behavior."
|
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(if (org-clocking-p)
|
(cond ((org-clocking-p)
|
||||||
(if arg
|
(if arg
|
||||||
(org-clock-cancel)
|
(org-clock-cancel)
|
||||||
(org-clock-out))
|
(org-clock-out)))
|
||||||
(org-clock-in-last arg)))
|
((and (null org-clock-history)
|
||||||
|
(or (org-on-heading-p)
|
||||||
|
(org-at-item-p))
|
||||||
|
(y-or-n-p "No active clock. Clock in on current item?"))
|
||||||
|
(org-clock-in))
|
||||||
|
((org-clock-in-last arg))))
|
||||||
|
|
||||||
|
|
||||||
;;; Folds
|
;;; Folds
|
||||||
|
|
|
@ -699,7 +699,8 @@ between the two."
|
||||||
"e" #'org-clock-modify-effort-estimate
|
"e" #'org-clock-modify-effort-estimate
|
||||||
"E" #'org-set-effort
|
"E" #'org-set-effort
|
||||||
"g" #'org-clock-goto
|
"g" #'org-clock-goto
|
||||||
"G" (λ! (org-clock-goto 'select))
|
"G" (cmd! (org-clock-goto 'select))
|
||||||
|
"l" #'+org/toggle-last-clock
|
||||||
"i" #'org-clock-in
|
"i" #'org-clock-in
|
||||||
"I" #'org-clock-in-last
|
"I" #'org-clock-in-last
|
||||||
"o" #'org-clock-out
|
"o" #'org-clock-out
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue