[Org] make ‘db/org-add-clocking-time’ take two arguments

This commit is contained in:
Daniel Borchmann 2017-12-15 21:45:50 +01:00
parent 076095b7e7
commit 28c6ae47a1
Signed by: exot
GPG Key ID: 4F63DB96D45AA9C6

View File

@ -512,18 +512,15 @@ are equal return nil."
(org-use-tag-inheritance nil)
(org-agenda-prefix-format '((tags . " ")))))))
(defun db/org-add-clocking-time ()
"Add \"CLOCK:\" line to the task under point in the current org-mode file.
Start and end time will be queried interactively."
(interactive)
;; FIXME: make this function to take two optional arguments
(if (not (eq major-mode 'org-mode))
(user-error "Must be in org mode")
(let* ((starting-time (org-read-date 4 'totime nil
(defun db/org-add-clocking-time (starting-time ending-time)
"Add \"CLOCK:\" line to the task under point in the current org-mode file."
(interactive
(list (starting-time (org-read-date 4 'totime nil
"Start:" (current-time) nil t))
(ending-time (org-read-date 4 'totime nil
"End:" (current-time) nil t)))
"End:" (current-time) nil t))))
(if (not (eq major-mode 'org-mode))
(user-error "Must be in org mode")
(save-mark-and-excursion
(org-clock-find-position nil)
(open-line 1)
@ -532,7 +529,7 @@ Start and end time will be queried interactively."
(org-insert-time-stamp starting-time t t)
(insert "--")
(org-insert-time-stamp ending-time t t)
(org-clock-update-time-maybe)))))
(org-clock-update-time-maybe))))
(bind-key "C-c C-x C-a" #'db/org-add-clocking-time org-mode-map)