mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 18:36:26 +00:00
Merge branch 'maint'
This commit is contained in:
commit
5d817df125
|
@ -5753,15 +5753,15 @@ Providing it allows for quicker computation."
|
|||
(org-with-wide-buffer
|
||||
(let* ((pos (point))
|
||||
(element (or element (org-element-at-point)))
|
||||
(type (org-element-type element)))
|
||||
(type (org-element-type element))
|
||||
(post (org-element-property :post-affiliated element)))
|
||||
;; If point is inside an element containing objects or
|
||||
;; a secondary string, narrow buffer to the container and
|
||||
;; proceed with parsing. Otherwise, return ELEMENT.
|
||||
(cond
|
||||
;; At a parsed affiliated keyword, check if we're inside main
|
||||
;; or dual value.
|
||||
((let ((post (org-element-property :post-affiliated element)))
|
||||
(and post (< pos post)))
|
||||
((and post (< pos post))
|
||||
(beginning-of-line)
|
||||
(let ((case-fold-search t)) (looking-at org-element--affiliated-re))
|
||||
(cond
|
||||
|
@ -5780,7 +5780,8 @@ Providing it allows for quicker computation."
|
|||
;; At an item, objects can only be located within tag, if any.
|
||||
((eq type 'item)
|
||||
(let ((tag (org-element-property :tag element)))
|
||||
(if (not tag) (throw 'objects-forbidden element)
|
||||
(if (or (not tag) (/= (line-beginning-position) post))
|
||||
(throw 'objects-forbidden element)
|
||||
(beginning-of-line)
|
||||
(search-forward tag (line-end-position))
|
||||
(goto-char (match-beginning 0))
|
||||
|
|
|
@ -3322,36 +3322,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
|
||||
|
@ -3361,14 +3368,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
|
||||
|
@ -3378,35 +3383,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
|
||||
|
|
Loading…
Reference in a new issue