Merge branch 'maint'
This commit is contained in:
commit
5a14001b5e
|
@ -4199,6 +4199,10 @@ elements.
|
||||||
Elements are accumulated into ACC."
|
Elements are accumulated into ACC."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
|
;; Visible only: skip invisible parts at the beginning of the
|
||||||
|
;; element.
|
||||||
|
(when (and visible-only (org-invisible-p2))
|
||||||
|
(goto-char (min (1+ (org-find-visible)) end)))
|
||||||
;; When parsing only headlines, skip any text before first one.
|
;; When parsing only headlines, skip any text before first one.
|
||||||
(when (and (eq granularity 'headline) (not (org-at-heading-p)))
|
(when (and (eq granularity 'headline) (not (org-at-heading-p)))
|
||||||
(org-with-limited-levels (outline-next-heading)))
|
(org-with-limited-levels (outline-next-heading)))
|
||||||
|
@ -4211,12 +4215,13 @@ Elements are accumulated into ACC."
|
||||||
(type (org-element-type element))
|
(type (org-element-type element))
|
||||||
(cbeg (org-element-property :contents-begin element)))
|
(cbeg (org-element-property :contents-begin element)))
|
||||||
(goto-char (org-element-property :end element))
|
(goto-char (org-element-property :end element))
|
||||||
|
;; Visible only: skip invisible parts between siblings.
|
||||||
|
(when (and visible-only (org-invisible-p2))
|
||||||
|
(goto-char (min (1+ (org-find-visible)) end)))
|
||||||
;; Fill ELEMENT contents by side-effect.
|
;; Fill ELEMENT contents by side-effect.
|
||||||
(cond
|
(cond
|
||||||
;; If VISIBLE-ONLY is true and element is hidden or if it has
|
;; If element has no contents, don't modify it.
|
||||||
;; no contents, don't modify it.
|
((not cbeg))
|
||||||
((or (and visible-only (org-element-property :hiddenp element))
|
|
||||||
(not cbeg)))
|
|
||||||
;; Greater element: parse it between `contents-begin' and
|
;; Greater element: parse it between `contents-begin' and
|
||||||
;; `contents-end'. Make sure GRANULARITY allows the
|
;; `contents-end'. Make sure GRANULARITY allows the
|
||||||
;; recursion, or ELEMENT is a headline, in which case going
|
;; recursion, or ELEMENT is a headline, in which case going
|
||||||
|
|
|
@ -2612,6 +2612,20 @@ Paragraph \\alpha."
|
||||||
(should (stringp (org-element-property :title (org-element-at-point))))))
|
(should (stringp (org-element-property :title (org-element-at-point))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; Test Visible Only Parsing
|
||||||
|
|
||||||
|
(ert-deftest test-org-element/parse-buffer-visible ()
|
||||||
|
"Test `org-element-parse-buffer' with visible only argument."
|
||||||
|
(should
|
||||||
|
(equal '("H1" "H3" "H5")
|
||||||
|
(org-test-with-temp-text
|
||||||
|
"* H1\n** H2\n** H3 :visible:\n** H4\n** H5 :visible:"
|
||||||
|
(org-occur ":visible:")
|
||||||
|
(org-element-map (org-element-parse-buffer nil t) 'headline
|
||||||
|
(lambda (hl) (org-element-property :raw-value hl)))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; Test `:parent' Property
|
;;; Test `:parent' Property
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue