Function: org-element--set-regexps

org-element--set-regexps is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element--set-regexps)

Documentation

Build variable syntax regexps.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
(defun org-element--set-regexps ()
  "Build variable syntax regexps."
  (setq org-element-paragraph-separate
	(concat "^\\(?:"
		;; Headlines, inlinetasks.
		"\\*+ " "\\|"
		;; Footnote definitions.
		"\\[fn:[-_[:word:]]+\\]" "\\|"
		;; Diary sexps.
		"%%(" "\\|"
		"[ \t]*\\(?:"
		;; Empty lines.
		"$" "\\|"
		;; Tables (any type).
		"|" "\\|"
		"\\+\\(?:-+\\+\\)+[ \t]*$" "\\|"
		;; Comments, keyword-like or block-like constructs.
		;; Blocks and keywords with dual values need to be
		;; double-checked.
		"#\\(?: \\|$\\|\\+\\(?:"
		"BEGIN_\\S-+" "\\|"
		"\\S-+\\(?:\\[.*\\]\\)?:[ \t]*\\)\\)"
		"\\|"
		;; Drawers (any type) and fixed-width areas.  Drawers
		;; need to be double-checked.
		":\\(?: \\|$\\|[-_[:word:]]+:[ \t]*$\\)" "\\|"
		;; Horizontal rules.
		"-\\{5,\\}[ \t]*$" "\\|"
		;; LaTeX environments.
		"\\\\begin{\\([A-Za-z0-9*]+\\)}" "\\|"
		;; Clock lines.
		org-element-clock-line-re "\\|"
		;; Lists.
		(let ((term (pcase org-plain-list-ordered-item-terminator
			      (?\) ")") (?. "\\.") (_ "[.)]")))
		      (alpha (and org-list-allow-alphabetical "\\|[A-Za-z]")))
		  (concat "\\(?:[-+*]\\|\\(?:[0-9]+" alpha "\\)" term "\\)"
			  "\\(?:[ \t]\\|$\\)"))
		"\\)\\)")
	org-element--object-regexp
	(mapconcat #'identity
		   (let ((link-types (regexp-opt (org-link-types))))
		     (list
		      ;; Sub/superscript.
		      "\\(?:[_^][-{(*+.,[:alnum:]]\\)"
		      ;; Bold, code, italic, strike-through, underline
		      ;; and verbatim.
                      (rx (or "*" "~" "=" "+" "_" "/") (not space))
		      ;; Plain links.
		      (concat "\\<" link-types ":")
		      ;; Objects starting with "[": citations,
		      ;; footnote reference, statistics cookie,
		      ;; timestamp (inactive) and regular link.
		      (format "\\[\\(?:%s\\)"
			      (mapconcat
			       #'identity
			       (list "cite[:/]"
				     "fn:"
				     "\\(?:[0-9]\\|\\(?:%\\|/[0-9]*\\)\\]\\)"
				     "\\[")
			       "\\|"))
		      ;; Objects starting with "@": export snippets.
		      "@@"
		      ;; Objects starting with "{": macro.
		      "{{{"
		      ;; Objects starting with "<" : timestamp
		      ;; (active, diary), target, radio target and
		      ;; angular links.
		      (concat "<\\(?:%%\\|<\\|[0-9]\\|" link-types "\\)")
		      ;; Objects starting with "$": latex fragment.
		      "\\$"
		      ;; Objects starting with "\": line break,
		      ;; entity, latex fragment.
		      "\\\\\\(?:[a-zA-Z[(]\\|\\\\[ \t]*$\\|_ +\\)"
		      ;; Objects starting with raw text: inline Babel
		      ;; source block, inline Babel call.
		      "\\(?:call\\|src\\)_"))
		   "\\|")))