summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-08-11 17:31:31 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2012-08-11 17:38:46 +0200
commitd856b29b3bdba8352c97eb6fbf32206cb4bac9e7 (patch)
treedea9492fc99ff9476f8fe2584ca3de1a0634506c
parent1737d3c4ee3278ae747945b570b01749737d0088 (diff)
downloadorg-mode-d856b29b3bdba8352c97eb6fbf32206cb4bac9e7.tar.gz
org-element: Fix comments in paragraph separator regexp
* lisp/org-element.el (org-element-paragraph-separate): Fix comments in paragraph separator regexp. Optimize it.
-rw-r--r--lisp/org-element.el47
1 files changed, 30 insertions, 17 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 0ca6231..dea6b98 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -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