Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2016-11-10 00:27:21 +01:00
commit c0b37e1883
2 changed files with 46 additions and 21 deletions

View File

@ -1018,15 +1018,14 @@ Assume point is at beginning of the headline."
(standard-props (org-element--get-node-properties)) (standard-props (org-element--get-node-properties))
(time-props (org-element--get-time-properties)) (time-props (org-element--get-time-properties))
(end (min (save-excursion (org-end-of-subtree t t)) limit)) (end (min (save-excursion (org-end-of-subtree t t)) limit))
(pos-after-head (progn (forward-line) (point)))
(contents-begin (save-excursion (contents-begin (save-excursion
(forward-line)
(skip-chars-forward " \r\t\n" end) (skip-chars-forward " \r\t\n" end)
(and (/= (point) end) (line-beginning-position)))) (and (/= (point) end) (line-beginning-position))))
(contents-end (and contents-begin (contents-end (and contents-begin
(progn (goto-char end) (progn (goto-char end)
(skip-chars-backward " \r\t\n") (skip-chars-backward " \r\t\n")
(forward-line) (line-beginning-position 2)))))
(point)))))
(let ((headline (let ((headline
(list 'headline (list 'headline
(nconc (nconc
@ -1035,7 +1034,7 @@ Assume point is at beginning of the headline."
:end end :end end
:pre-blank :pre-blank
(if (not contents-begin) 0 (if (not contents-begin) 0
(count-lines pos-after-head contents-begin)) (1- (count-lines begin contents-begin)))
:contents-begin contents-begin :contents-begin contents-begin
:contents-end contents-end :contents-end contents-end
:level level :level level
@ -1043,9 +1042,10 @@ Assume point is at beginning of the headline."
:tags tags :tags tags
:todo-keyword todo :todo-keyword todo
:todo-type todo-type :todo-type todo-type
:post-blank (count-lines :post-blank
(or contents-end pos-after-head) (if contents-end
end) (count-lines contents-end end)
(1- (count-lines begin end)))
:footnote-section-p footnote-section-p :footnote-section-p footnote-section-p
:archivedp archivedp :archivedp archivedp
:commentedp commentedp :commentedp commentedp
@ -1116,10 +1116,11 @@ CONTENTS is the contents of the element."
"Parse an inline task. "Parse an inline task.
Return a list whose CAR is `inlinetask' and CDR is a plist Return a list whose CAR is `inlinetask' and CDR is a plist
containing `:title', `:begin', `:end', `:contents-begin' and containing `:title', `:begin', `:end', `:pre-blank',
`:contents-end', `:level', `:priority', `:raw-value', `:tags', `:contents-begin' and `:contents-end', `:level', `:priority',
`:todo-keyword', `:todo-type', `:scheduled', `:deadline', `:raw-value', `:tags', `:todo-keyword', `:todo-type',
`:closed', `:post-blank' and `:post-affiliated' keywords. `:scheduled', `:deadline', `:closed', `:post-blank' and
`:post-affiliated' keywords.
The plist also contains any property set in the property drawer, The plist also contains any property set in the property drawer,
with its name in upper cases and colons added at the with its name in upper cases and colons added at the
@ -1157,18 +1158,20 @@ Assume point is at beginning of the inline task."
(task-end (save-excursion (task-end (save-excursion
(end-of-line) (end-of-line)
(and (re-search-forward org-outline-regexp-bol limit t) (and (re-search-forward org-outline-regexp-bol limit t)
(looking-at-p "END[ \t]*$") (looking-at-p "[ \t]*END[ \t]*$")
(line-beginning-position)))) (line-beginning-position))))
(standard-props (and task-end (org-element--get-node-properties))) (standard-props (and task-end (org-element--get-node-properties)))
(time-props (and task-end (org-element--get-time-properties))) (time-props (and task-end (org-element--get-time-properties)))
(contents-begin (progn (forward-line) (contents-begin (and task-end
(and task-end (< (point) task-end) (point)))) (< (point) task-end)
(progn
(forward-line)
(skip-chars-forward " \t\n")
(line-beginning-position))))
(contents-end (and contents-begin task-end)) (contents-end (and contents-begin task-end))
(before-blank (if (not task-end) (point) (end (progn (when task-end (goto-char task-end))
(goto-char task-end) (forward-line)
(forward-line) (skip-chars-forward " \r\t\n" limit)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
(if (eobp) (point) (line-beginning-position)))) (if (eobp) (point) (line-beginning-position))))
(inlinetask (inlinetask
(list 'inlinetask (list 'inlinetask
@ -1176,6 +1179,9 @@ Assume point is at beginning of the inline task."
(list :raw-value raw-value (list :raw-value raw-value
:begin begin :begin begin
:end end :end end
:pre-blank
(if (not contents-begin) 0
(1- (count-lines begin contents-begin)))
:contents-begin contents-begin :contents-begin contents-begin
:contents-end contents-end :contents-end contents-end
:level level :level level
@ -1183,7 +1189,7 @@ Assume point is at beginning of the inline task."
:tags tags :tags tags
:todo-keyword todo :todo-keyword todo
:todo-type todo-type :todo-type todo-type
:post-blank (count-lines before-blank end) :post-blank (1- (count-lines (or task-end begin) end))
:post-affiliated begin) :post-affiliated begin)
time-props time-props
standard-props)))) standard-props))))
@ -3839,10 +3845,14 @@ element it has to parse."
(or (save-excursion (org-with-limited-levels (outline-next-heading))) (or (save-excursion (org-with-limited-levels (outline-next-heading)))
limit))) limit)))
;; Planning. ;; Planning.
((and (eq mode 'planning) (looking-at org-planning-line-re)) ((and (eq mode 'planning)
(eq ?* (char-after (line-beginning-position 0)))
(looking-at org-planning-line-re))
(org-element-planning-parser limit)) (org-element-planning-parser limit))
;; Property drawer. ;; Property drawer.
((and (memq mode '(planning property-drawer)) ((and (memq mode '(planning property-drawer))
(eq ?* (char-after (line-beginning-position
(if (eq mode 'planning) 0 -1))))
(looking-at org-property-drawer-re)) (looking-at org-property-drawer-re))
(org-element-property-drawer-parser limit)) (org-element-property-drawer-parser limit))
;; When not at bol, point is at the beginning of an item or ;; When not at bol, point is at the beginning of an item or

View File

@ -1269,6 +1269,11 @@ Some other text
(org-test-with-temp-text (org-test-with-temp-text
"*************** Task\nTest\n*************** END" "*************** Task\nTest\n*************** END"
(org-element-type (org-element-at-point))))) (org-element-type (org-element-at-point)))))
(should
(eq 'inlinetask
(org-test-with-temp-text
"*************** Task\nTest\n*************** END"
(org-element-type (org-element-at-point)))))
;; Degenerate inlinetask. ;; Degenerate inlinetask.
(should (should
(eq 'inlinetask (eq 'inlinetask
@ -1966,6 +1971,11 @@ Outside list"
(eq 'planning (eq 'planning
(org-test-with-temp-text (org-test-with-temp-text
"* H\n# Comment\n<point>DEADLINE: <2012-03-29 thu.>" "* H\n# Comment\n<point>DEADLINE: <2012-03-29 thu.>"
(org-element-type (org-element-at-point)))))
(should-not
(eq 'planning
(org-test-with-temp-text
"* H\n\n<point>DEADLINE: <2012-03-29 thu.>"
(org-element-type (org-element-at-point)))))) (org-element-type (org-element-at-point))))))
@ -2008,6 +2018,11 @@ Outside list"
(org-test-with-temp-text (org-test-with-temp-text
"* H\nParagraph\n<point>:PROPERTIES:\nparagraph\n:END:" "* H\nParagraph\n<point>:PROPERTIES:\nparagraph\n:END:"
(org-element-type (org-element-at-point))))) (org-element-type (org-element-at-point)))))
(should-not
(eq 'property-drawer
(org-test-with-temp-text
"* H\n\n<point>:PROPERTIES:\n:prop: value\n:END:"
(org-element-type (org-element-at-point)))))
;; Handle non-empty blank line at the end of buffer. ;; Handle non-empty blank line at the end of buffer.
(should (should
(org-test-with-temp-text "* H\n<point>:PROPERTIES:\n:END:\n " (org-test-with-temp-text "* H\n<point>:PROPERTIES:\n:END:\n "