org-element: Do not parse timestamps within planning line

* lisp/org-element.el (org-element-context): Do not parse timestamps
  within planning line.
* testing/lisp/test-org-element.el (test-org-element/context): Remove test.

Strictly speaking, timestamps within planning lines are parameters
values that use timestamp syntax, not real timestamps belonging to the
document contents.
This commit is contained in:
Nicolas Goaziou 2017-05-14 10:25:13 +02:00
parent de2a8b31e4
commit cbbe00e30e
2 changed files with 0 additions and 20 deletions

View File

@ -5867,17 +5867,6 @@ Providing it allows for quicker computation."
(or (< pos cend) (and (= pos cend) (eobp))))
(narrow-to-region cbeg cend)
(throw 'objects-forbidden element))))
;; At a planning line, if point is at a timestamp, return it,
;; otherwise, return element.
((eq type 'planning)
(dolist (p '(:closed :deadline :scheduled))
(let ((timestamp (org-element-property p element)))
(when (and timestamp
(<= (org-element-property :begin timestamp) pos)
(> (org-element-property :end timestamp) pos))
(throw 'objects-forbidden timestamp))))
;; All other locations cannot contain objects: bail out.
(throw 'objects-forbidden element))
(t (throw 'objects-forbidden element)))
(goto-char (point-min))
(let ((restriction (org-element-restriction type))

View File

@ -3417,15 +3417,6 @@ Text
(eq 'table-cell
(org-test-with-temp-text "| a | b<point> {{{macro}}} |"
(org-element-type (org-element-context)))))
;; Find objects in planning lines.
(should
(eq 'timestamp
(org-test-with-temp-text "* H\n SCHEDULED: <2012<point>-03-29 thu.>"
(org-element-type (org-element-context)))))
(should-not
(eq 'timestamp
(org-test-with-temp-text "* H\n SCHEDULED<point>: <2012-03-29 thu.>"
(org-element-type (org-element-context)))))
;; Find objects in item tags.
(should
(eq 'bold