Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2012-09-01 22:57:19 +02:00
commit 90aae1e2e8
2 changed files with 21 additions and 16 deletions

View File

@ -1189,18 +1189,18 @@ and `:post-blank' keywords."
(save-excursion
;; Beginning of section is the beginning of the first non-blank
;; line after previous headline.
(org-with-limited-levels
(let ((begin (point))
(end (progn (goto-char limit) (point)))
(pos-before-blank (progn (skip-chars-backward " \r\t\n")
(forward-line)
(point))))
(list 'section
(list :begin begin
:end end
:contents-begin begin
:contents-end pos-before-blank
:post-blank (count-lines pos-before-blank end)))))))
(let ((begin (point))
(end (progn (org-with-limited-levels (outline-next-heading))
(point)))
(pos-before-blank (progn (skip-chars-backward " \r\t\n")
(forward-line)
(point))))
(list 'section
(list :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.
@ -3355,15 +3355,14 @@ element it has to parse."
;; Item.
((eq special 'item)
(org-element-item-parser limit structure raw-secondary-p))
;; Quote Section.
((eq special 'quote-section) (org-element-quote-section-parser limit))
;; Table Row.
((eq special 'table-row) (org-element-table-row-parser limit))
;; Headline.
((org-with-limited-levels (org-at-heading-p))
(org-element-headline-parser limit raw-secondary-p))
;; Section (must be checked after headline).
;; Sections (must be checked after headline).
((eq special 'section) (org-element-section-parser limit))
((eq special 'quote-section) (org-element-quote-section-parser limit))
((eq special 'first-section)
(org-element-section-parser
(or (save-excursion (org-with-limited-levels (outline-next-heading)))

View File

@ -1345,7 +1345,13 @@ Outside list"
;; A section cannot be empty.
(should-not
(org-test-with-temp-text "* Headline 1\n* Headline 2"
(org-element-map (org-element-parse-buffer) 'section 'identity))))
(org-element-map (org-element-parse-buffer) 'section 'identity)))
;; A section doesn't contain sub-trees.
(should-not
(org-test-with-temp-text "* Head\nText\n** Sub-Head"
(org-element-map
(org-element-map (org-element-parse-buffer) 'section 'identity nil t)
'headline 'identity))))
;;;; Special Block