Function: org-element-comment-parser
org-element-comment-parser is a byte-compiled function defined in
org-element.el.gz.
Signature
(org-element-comment-parser LIMIT)
Documentation
Parse a comment.
LIMIT bounds the search.
Return a new syntax node of comment type containing :begin,
:end, :value, :post-blank, :post-affiliated properties.
Assume point is at comment beginning.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;;;; Comment
(defun org-element-comment-parser (limit)
"Parse a comment.
LIMIT bounds the search.
Return a new syntax node of `comment' type containing `:begin',
`:end', `:value', `:post-blank', `:post-affiliated' properties.
Assume point is at comment beginning."
(save-excursion
(let* ((begin (point))
(value (prog2 (looking-at org-comment-regexp)
(buffer-substring-no-properties
(match-end 0) (line-end-position))
(forward-line)))
(com-end
;; Get comments ending.
(progn
(while (and (< (point) limit) (looking-at org-comment-regexp))
;; Accumulate lines without leading hash and first
;; whitespace.
(setq value
(concat value
"\n"
(buffer-substring-no-properties
(match-end 0) (line-end-position))))
(forward-line))
(point)))
(end (progn (goto-char com-end)
(skip-chars-forward " \r\t\n" limit)
(if (eobp) (point) (line-beginning-position)))))
(org-element-create
'comment
(list :begin begin
:end end
:value value
:post-blank (count-lines com-end end)
:post-affiliated begin)))))