|
@@ -3332,36 +3332,43 @@ Text
|
|
|
;; Return closest object containing point.
|
|
|
(should
|
|
|
(eq 'underline
|
|
|
- (org-test-with-temp-text "Some *text with _underline_ text*"
|
|
|
- (progn (search-forward "under")
|
|
|
- (org-element-type (org-element-context))))))
|
|
|
+ (org-test-with-temp-text "Some *text with _under<point>line_ text*"
|
|
|
+ (org-element-type (org-element-context)))))
|
|
|
;; Find objects in secondary strings.
|
|
|
(should
|
|
|
(eq 'underline
|
|
|
- (org-test-with-temp-text "* Headline _with_ underlining"
|
|
|
- (progn (search-forward "w")
|
|
|
- (org-element-type (org-element-context))))))
|
|
|
+ (org-test-with-temp-text "* Headline _<point>with_ underlining"
|
|
|
+ (org-element-type (org-element-context)))))
|
|
|
;; Find objects in objects.
|
|
|
(should
|
|
|
(eq 'macro
|
|
|
- (org-test-with-temp-text "| a | {{{macro}}} |"
|
|
|
- (progn (search-forward "{")
|
|
|
- (org-element-type (org-element-context))))))
|
|
|
+ (org-test-with-temp-text "| a | {<point>{{macro}}} |"
|
|
|
+ (org-element-type (org-element-context)))))
|
|
|
(should
|
|
|
(eq 'table-cell
|
|
|
- (org-test-with-temp-text "| a | b {{{macro}}} |"
|
|
|
- (progn (search-forward "b")
|
|
|
- (org-element-type (org-element-context))))))
|
|
|
+ (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-03-29 thu.>"
|
|
|
- (search-forward "2012")
|
|
|
+ (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: <2012-03-29 thu.>"
|
|
|
- (search-forward "SCHEDULED")
|
|
|
+ (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
|
|
|
+ (org-test-with-temp-text "- *bo<point>ld* ::"
|
|
|
+ (org-element-type (org-element-context)))))
|
|
|
+ (should-not
|
|
|
+ (eq 'bold
|
|
|
+ (org-test-with-temp-text "- *bold* ::<point>"
|
|
|
+ (org-element-type (org-element-context)))))
|
|
|
+ (should-not
|
|
|
+ (eq 'bold
|
|
|
+ (org-test-with-temp-text "- *bold* ::\n<point>"
|
|
|
(org-element-type (org-element-context)))))
|
|
|
;; Do not find objects in table rules.
|
|
|
(should
|
|
@@ -3371,14 +3378,12 @@ Text
|
|
|
;; Find objects in parsed affiliated keywords.
|
|
|
(should
|
|
|
(eq 'macro
|
|
|
- (org-test-with-temp-text "#+CAPTION: {{{macro}}}\n| a | b |."
|
|
|
- (progn (search-forward "{")
|
|
|
- (org-element-type (org-element-context))))))
|
|
|
+ (org-test-with-temp-text "#+CAPTION: {<point>{{macro}}}\n| a | b |"
|
|
|
+ (org-element-type (org-element-context)))))
|
|
|
(should
|
|
|
(eq 'bold
|
|
|
- (org-test-with-temp-text "#+caption: *bold*\nParagraph"
|
|
|
- (progn (search-forward "*")
|
|
|
- (org-element-type (org-element-context))))))
|
|
|
+ (org-test-with-temp-text "#+caption: *<point>bold*\nParagraph"
|
|
|
+ (org-element-type (org-element-context)))))
|
|
|
;; Find objects at the end of buffer.
|
|
|
(should
|
|
|
(eq 'bold
|
|
@@ -3388,35 +3393,28 @@ Text
|
|
|
;; Correctly set `:parent' property.
|
|
|
(should
|
|
|
(eq 'paragraph
|
|
|
- (org-test-with-temp-text "Some *bold* text"
|
|
|
- (progn (search-forward "bold")
|
|
|
- (org-element-type
|
|
|
- (org-element-property :parent (org-element-context)))))))
|
|
|
+ (org-test-with-temp-text "Some *bold<point>* text"
|
|
|
+ (org-element-type
|
|
|
+ (org-element-property :parent (org-element-context))))))
|
|
|
;; Between two objects, return the second one.
|
|
|
(should
|
|
|
(eq 'macro
|
|
|
- (org-test-with-temp-text "<<target>>{{{test}}}"
|
|
|
- (progn (search-forward "{")
|
|
|
- (backward-char)
|
|
|
- (org-element-type (org-element-context))))))
|
|
|
+ (org-test-with-temp-text "<<target>><point>{{{test}}}"
|
|
|
+ (org-element-type (org-element-context)))))
|
|
|
;; Test optional argument.
|
|
|
(should
|
|
|
(eq 'underline
|
|
|
- (org-test-with-temp-text "Some *text with _underline_ text*"
|
|
|
- (progn
|
|
|
- (search-forward "under")
|
|
|
- (org-element-type (org-element-context (org-element-at-point)))))))
|
|
|
+ (org-test-with-temp-text "Some *text with _under<point>line_ text*"
|
|
|
+ (org-element-type (org-element-context (org-element-at-point))))))
|
|
|
;; Special case: bold object at the beginning of a headline.
|
|
|
(should
|
|
|
(eq 'bold
|
|
|
- (org-test-with-temp-text "* *bold*"
|
|
|
- (search-forward "bo")
|
|
|
+ (org-test-with-temp-text "* *bo<point>ld*"
|
|
|
(org-element-type (org-element-context)))))
|
|
|
;; Special case: incomplete cell at the end of a table row.
|
|
|
(should
|
|
|
(eq 'table-cell
|
|
|
- (org-test-with-temp-text "|a|b|c"
|
|
|
- (goto-char (point-max))
|
|
|
+ (org-test-with-temp-text "|a|b|c<point>"
|
|
|
(org-element-type (org-element-context)))))
|
|
|
;; Special case: objects in inline footnotes.
|
|
|
(should
|