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 new syntax node of clock type containing :status,
:value, :time, :begin, :end, :post-blank and
:post-affiliated as properties.

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 new syntax node of `clock' type containing `:status',
`:value', `:time', `:begin', `:end', `:post-blank' and
`:post-affiliated' as properties."
  (save-excursion
    (let* ((begin (point))
	   (value (progn (search-forward "CLOCK:" (line-end-position))
			 (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) (skip-chars-forward " \t"))
			 (count-lines before-blank (point))))
	   (end (point)))
      (org-element-create
       'clock
       (list :status status
	     :value value
	     :duration duration
	     :begin begin
	     :end end
	     :post-blank post-blank
	     :post-affiliated begin)))))