Function: org-element-keyword-parser

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

Signature

(org-element-keyword-parser LIMIT AFFILIATED)

Documentation

Parse a keyword at point.

LIMIT bounds the search. AFFILIATED is a list of which CAR is the buffer position at the beginning of the first affiliated keyword and CDR is a plist of affiliated keywords along with their value.

Return a new syntax node of keyword type containing :key,
:value, :begin, :end, :post-blank and :post-affiliated
properties.

Source Code

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

(defun org-element-keyword-parser (limit affiliated)
  "Parse a keyword at point.

LIMIT bounds the search.  AFFILIATED is a list of which CAR is
the buffer position at the beginning of the first affiliated
keyword and CDR is a plist of affiliated keywords along with
their value.

Return a new syntax node of `keyword' type containing `:key',
`:value', `:begin', `:end', `:post-blank' and `:post-affiliated'
properties."
  (save-excursion
    ;; An orphaned affiliated keyword is considered as a regular
    ;; keyword.  In this case AFFILIATED is nil, so we take care of
    ;; this corner case.
    (let ((begin (or (car affiliated) (point)))
	  (post-affiliated (point))
	  (key (progn (looking-at "[ \t]*#\\+\\(\\S-*\\):")
		      (org-element--get-cached-string
                       (upcase (match-string-no-properties 1)))))
	  (value (org-trim (buffer-substring-no-properties
                            (match-end 0) (line-end-position))))
	  (pos-before-blank (progn (forward-line) (point)))
	  (end (progn (skip-chars-forward " \r\t\n" limit)
		      (if (eobp) (point) (line-beginning-position)))))
      (org-element-create
       'keyword
       (nconc
	(list :key key
	      :value value
	      :begin begin
	      :end end
	      :post-blank (count-lines pos-before-blank end)
	      :post-affiliated post-affiliated)
	(cdr affiliated))))))