Function: org-element-clock-parser

org-element-clock-parser is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element-clock-parser LIMIT)

Documentation

Parse a clock.

LIMIT bounds the search.

Return a list whose CAR is clock and CDR is a plist containing
:status, :value, :time, :begin, :end, :post-blank and
:post-affiliated as keywords.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;;;; Clock

(defun org-element-clock-parser (limit)
  "Parse a clock.

LIMIT bounds the search.

Return a list whose CAR is `clock' and CDR is a plist containing
`:status', `:value', `:time', `:begin', `:end', `:post-blank' and
`:post-affiliated' as keywords."
  (save-excursion
    (let* ((case-fold-search nil)
	   (begin (point))
	   (value (progn (search-forward "CLOCK:" (line-end-position) t)
			 (skip-chars-forward " \t")
			 (org-element-timestamp-parser)))
	   (duration (and (search-forward " => " (line-end-position) t)
			  (progn (skip-chars-forward " \t")
				 (looking-at "\\(\\S-+\\)[ \t]*$"))
			  (match-string-no-properties 1)))
	   (status (if duration 'closed 'running))
	   (post-blank (let ((before-blank (progn (forward-line) (point))))
			 (skip-chars-forward " \r\t\n" limit)
			 (skip-chars-backward " \t")
			 (unless (bolp) (end-of-line))
			 (count-lines before-blank (point))))
	   (end (point)))
      (list 'clock
	    (list :status status
		  :value value
		  :duration duration
		  :begin begin
		  :end end
		  :post-blank post-blank
		  :post-affiliated begin)))))