Browse Source

org-element: Correctly parse inlinetasks before first headline

* contrib/lisp/org-element.el (org-element-section-parser): Correctly
  parse inlinetasks before first headline.
Nicolas Goaziou 13 years ago
parent
commit
588a7c261b
1 changed files with 16 additions and 15 deletions
  1. 16 15
      contrib/lisp/org-element.el

+ 16 - 15
contrib/lisp/org-element.el

@@ -752,21 +752,22 @@ and `:post-blank' keywords."
   (save-excursion
     ;; Beginning of section is the beginning of the first non-blank
     ;; line after previous headline.
-    (let ((begin (save-excursion
-		   (org-with-limited-levels (outline-previous-heading))
-		   (if (not (org-at-heading-p)) (point)
-		     (forward-line) (org-skip-whitespace) (point-at-bol))))
-	  (end (progn (org-with-limited-levels (outline-next-heading))
-		      (point)))
-	  (pos-before-blank (progn (skip-chars-backward " \r\t\n")
-				   (forward-line)
-				   (point))))
-      `(section
-	(:begin ,begin
-		:end ,end
-		:contents-begin ,begin
-		:contents-end ,pos-before-blank
-		:post-blank ,(count-lines pos-before-blank end))))))
+    (org-with-limited-levels
+     (let ((begin
+	    (save-excursion
+	      (outline-previous-heading)
+	      (if (not (org-at-heading-p)) (point)
+		(forward-line) (org-skip-whitespace) (point-at-bol))))
+	   (end (progn (outline-next-heading) (point)))
+	   (pos-before-blank (progn (skip-chars-backward " \r\t\n")
+				    (forward-line)
+				    (point))))
+       `(section
+	 (:begin ,begin
+		 :end ,end
+		 :contents-begin ,begin
+		 :contents-end ,pos-before-blank
+		 :post-blank ,(count-lines pos-before-blank end)))))))
 
 (defun org-element-section-interpreter (section contents)
   "Interpret SECTION element as Org syntax.