I think something like this is what you are looking for: #+BEGIN_SRC emacs-lisp (defun get-clock-lines () "Return org-element representations of clock lines in a logbook drawer." (interactive) (save-excursion (goto-char (org-log-beginning)) (let ((logbook (org-element-at-point)) (clock-entries '()) (current-element)) (goto-char (org-element-property :contents-begin logbook)) (setq current-element (org-element-at-point)) (while (eq 'clock (car current-element)) (push current-element clock-entries) (forward-line) (setq current-element (org-element-at-point))) (reverse clock-entries))))
(get-clock-lines) #+END_SRC Cody Goodman <codygman.consult...@gmail.com> writes: > Given a TODO that looks like this: > > *** DONE put into spacemacs file > CLOSED: [2018-08-04 Sat 21:18] > :LOGBOOK: > CLOCK: [2018-08-04 Sat 21:16]--[2018-08-04 Sat 12:18] => 0:02 > :END: > > What function will get me the parts in CLOCK: [2018-08-04 Sat > 21:16]--[2018-08-04 Sat 12:18] => 0:02, preferably in plist format like > the closed timestamp org-element-at-point gives back of: > > (timestamp (:type inactive :raw-value "[2018-08-04 Sat 21:18]" :year-start > 2018 :month-start 8 :day-start 4 :hour-start 21 :minute-start 18 :year-end > 2018 :month-end 8 :day-end 4 :hour-end 21 :minute-end 18 :begin 46 :end 68 > :post-blank 0) > > Note org-element-at-point doesn't give back logbook information: > > (headline (:raw-value "put into spacemacs file" :begin 1 :end 157 > :pre-blank 0 :contents-begin 34 :contents-end 157 :level 3 :priority nil > :tags nil :todo-keyword #("DONE" 0 4 (fontified t face org-done)) > :todo-type done :post-blank 0 :footnote-section-p nil :archivedp nil > :commentedp nil :post-affiliated 1 :closed (timestamp (:type inactive > :raw-value "[2018-08-04 Sat 21:18]" :year-start 2018 :month-start 8 > :day-start 4 :hour-start 21 :minute-start 18 :year-end 2018 :month-end 8 > :day-end 4 :hour-end 21 :minute-end 18 :begin 46 :end 68 :post-blank 0)) > :title "put into spacemacs file")) > > Thanks, > > Cody -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu