[Org] make ‘db/org-add-clocking-time’ take two arguments
This commit is contained in:
parent
076095b7e7
commit
28c6ae47a1
@ -512,27 +512,24 @@ are equal return nil."
|
|||||||
(org-use-tag-inheritance nil)
|
(org-use-tag-inheritance nil)
|
||||||
(org-agenda-prefix-format '((tags . " ")))))))
|
(org-agenda-prefix-format '((tags . " ")))))))
|
||||||
|
|
||||||
(defun db/org-add-clocking-time ()
|
(defun db/org-add-clocking-time (starting-time ending-time)
|
||||||
"Add \"CLOCK:\" line to the task under point in the current org-mode file.
|
"Add \"CLOCK:\" line to the task under point in the current org-mode file."
|
||||||
|
(interactive
|
||||||
Start and end time will be queried interactively."
|
(list (starting-time (org-read-date 4 'totime nil
|
||||||
(interactive)
|
"Start:" (current-time) nil t))
|
||||||
;; FIXME: make this function to take two optional arguments
|
(ending-time (org-read-date 4 'totime nil
|
||||||
|
"End:" (current-time) nil t))))
|
||||||
(if (not (eq major-mode 'org-mode))
|
(if (not (eq major-mode 'org-mode))
|
||||||
(user-error "Must be in org mode")
|
(user-error "Must be in org mode")
|
||||||
(let* ((starting-time (org-read-date 4 'totime nil
|
(save-mark-and-excursion
|
||||||
"Start:" (current-time) nil t))
|
(org-clock-find-position nil)
|
||||||
(ending-time (org-read-date 4 'totime nil
|
(open-line 1)
|
||||||
"End:" (current-time) nil t)))
|
(indent-according-to-mode)
|
||||||
(save-mark-and-excursion
|
(insert "CLOCK: ")
|
||||||
(org-clock-find-position nil)
|
(org-insert-time-stamp starting-time t t)
|
||||||
(open-line 1)
|
(insert "--")
|
||||||
(indent-according-to-mode)
|
(org-insert-time-stamp ending-time t t)
|
||||||
(insert "CLOCK: ")
|
(org-clock-update-time-maybe))))
|
||||||
(org-insert-time-stamp starting-time t t)
|
|
||||||
(insert "--")
|
|
||||||
(org-insert-time-stamp ending-time t t)
|
|
||||||
(org-clock-update-time-maybe)))))
|
|
||||||
|
|
||||||
(bind-key "C-c C-x C-a" #'db/org-add-clocking-time org-mode-map)
|
(bind-key "C-c C-x C-a" #'db/org-add-clocking-time org-mode-map)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user