org-element: Fix comments in paragraph separator regexp

* lisp/org-element.el (org-element-paragraph-separate): Fix comments
  in paragraph separator regexp.  Optimize it.
This commit is contained in:
Nicolas Goaziou 2012-08-11 17:31:31 +02:00
parent 1737d3c4ee
commit d856b29b3b
1 changed files with 30 additions and 17 deletions

View File

@ -123,23 +123,36 @@
;; process.
(defconst org-element-paragraph-separate
(concat "^[ \t]*$" "\\|"
;; Headlines and inlinetasks.
org-outline-regexp-bol "\\|"
;; Comments, blocks (any type), keywords and babel calls.
"^[ \t]*#\\+" "\\|" "^#\\(?: \\|$\\)" "\\|"
;; Lists.
(org-item-beginning-re) "\\|"
;; Fixed-width, drawers (any type) and tables.
"^[ \t]*[:|]" "\\|"
;; Footnote definitions.
org-footnote-definition-re "\\|"
;; Horizontal rules.
"^[ \t]*-\\{5,\\}[ \t]*$" "\\|"
;; LaTeX environments.
"^[ \t]*\\\\\\(begin\\|end\\)" "\\|"
;; Planning and Clock lines.
org-planning-or-clock-line-re)
(concat "^\\(?:"
;; Headlines, inlinetasks.
org-outline-regexp "\\|"
;; Footnote definitions.
"\\[\\(?:[0-9]+\\|fn:[-_[:word:]]+\\)\\]" "\\|"
"[ \t]*\\(?:"
;; Empty lines.
"$" "\\|"
;; Comments, blocks (any type), keywords, Babel calls,
;; drawers (any type) and tables.
"[|#]" "\\|"
;; Fixed width areas.
":\\(?:[ \t]\\|$\\)" "\\|"
;; Horizontal rules.
"-\\{5,\\}[ \t]*$" "\\|"
;; LaTeX environments.
"\\\\\\(begin\\|end\\)" "\\|"
;; Planning and Clock lines.
(regexp-opt (list org-scheduled-string
org-deadline-string
org-closed-string
org-clock-string))
"\\|"
;; Lists.
(let ((term (case org-plain-list-ordered-item-terminator
(t "[.)]") (?\) ")") (?. "\\.") (otherwise "[.)]")))
(alpha (and org-alphabetical-lists "\\|[A-Za-z]")))
(concat "\\(?:[-+*]\\|\\(?:[0-9]+" alpha "\\)" term "\\)"
"\\(?:[ \t]\\|$\\)"))
"\\)\\)")
"Regexp to separate paragraphs in an Org buffer.")
(defconst org-element-all-elements