mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 19:37:52 +00:00
org-element-context: Use element cache
* lisp/org-element.el (org-element-context): Use `org-element-at-point', which makes use of cache. * testing/lisp/test-org-element.el (test-org-element/lineage): Expect full lineage up to org-data from `org-element-context'.
This commit is contained in:
parent
f41ba23689
commit
9b58ead467
|
@ -7751,7 +7751,7 @@ Providing it allows for quicker computation."
|
||||||
(catch 'objects-forbidden
|
(catch 'objects-forbidden
|
||||||
(org-with-wide-buffer
|
(org-with-wide-buffer
|
||||||
(let* ((pos (point))
|
(let* ((pos (point))
|
||||||
(element (or element (org-element-at-point-no-context)))
|
(element (or element (org-element-at-point)))
|
||||||
(type (org-element-type element))
|
(type (org-element-type element))
|
||||||
(post (org-element-property :post-affiliated element)))
|
(post (org-element-property :post-affiliated element)))
|
||||||
;; If point is inside an element containing objects or
|
;; If point is inside an element containing objects or
|
||||||
|
|
|
@ -3866,7 +3866,7 @@ Text
|
||||||
;; `org-element-at-point' or `org-element-context', the list is
|
;; `org-element-at-point' or `org-element-context', the list is
|
||||||
;; limited to the current section.
|
;; limited to the current section.
|
||||||
(should
|
(should
|
||||||
(equal '(paragraph center-block section headline)
|
(equal '(paragraph center-block section headline headline org-data)
|
||||||
(org-test-with-temp-text
|
(org-test-with-temp-text
|
||||||
"* H1\n** H2\n#+BEGIN_CENTER\n*bold<point>*\n#+END_CENTER"
|
"* H1\n** H2\n#+BEGIN_CENTER\n*bold<point>*\n#+END_CENTER"
|
||||||
(mapcar #'car (org-element-lineage (org-element-context))))))
|
(mapcar #'car (org-element-lineage (org-element-context))))))
|
||||||
|
@ -3891,7 +3891,7 @@ Text
|
||||||
(org-element-lineage (org-element-context) '(example-block))))
|
(org-element-lineage (org-element-context) '(example-block))))
|
||||||
;; Test WITH-SELF optional argument.
|
;; Test WITH-SELF optional argument.
|
||||||
(should
|
(should
|
||||||
(equal '(bold paragraph center-block section headline)
|
(equal '(bold paragraph center-block section headline headline org-data)
|
||||||
(org-test-with-temp-text
|
(org-test-with-temp-text
|
||||||
"* H1\n** H2\n#+BEGIN_CENTER\n*bold<point>*\n#+END_CENTER"
|
"* H1\n** H2\n#+BEGIN_CENTER\n*bold<point>*\n#+END_CENTER"
|
||||||
(mapcar #'car (org-element-lineage (org-element-context) nil t)))))
|
(mapcar #'car (org-element-lineage (org-element-context) nil t)))))
|
||||||
|
|
Loading…
Reference in a new issue