[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 81a7e8c836 037/101: org-element-lineage: Allow TYPE
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 81a7e8c836 037/101: org-element-lineage: Allow TYPES to be a symbol |
Date: |
Sat, 1 Jul 2023 09:59:03 -0400 (EDT) |
branch: externals/org
commit 81a7e8c8360aca076b1eb12a8bc6ae111f3a9578
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-element-lineage: Allow TYPES to be a symbol
* lisp/org-element-ast.el (org-element-lineage): Allow TYPES argument
to be a symbol.
* lisp/ox-ascii.el (org-ascii--current-text-width):
(org-ascii-format-inlinetask-default):
(org-ascii-section):
* lisp/ox-beamer.el (org-beamer--format-block):
* lisp/ox-html.el (org-html-section):
(org-html-table-cell):
(org-html-table-row):
* lisp/ox-latex.el (org-latex-table-cell):
(org-latex-table-row):
* lisp/ox-odt.el (org-odt-headline):
(org-odt-table-style-spec):
(org-odt-get-table-cell-styles):
(org-odt-table-cell):
(org-odt-table-row):
* lisp/ox-org.el (org-org-section):
* lisp/ox-publish.el (org-publish-collect-index):
* lisp/ox-texinfo.el (org-texinfo--get-node):
(org-texinfo-section):
(org-texinfo-table-row):
* lisp/ox.el (org-export--skip-p):
(org-export-get-node-property):
(org-export-table-cell-borders):
(org-export-table-row-in-header-p):
(org-export-table-row-number):
(org-export-collect-headlines): Update all the callers.
---
lisp/ob-tangle.el | 6 +++++-
lisp/oc.el | 5 +++--
lisp/ol.el | 4 ++--
lisp/org-capture.el | 4 ++--
lisp/org-compat.el | 2 +-
lisp/org-cycle.el | 2 +-
lisp/org-element-ast.el | 6 ++++--
lisp/org-footnote.el | 4 ++--
lisp/org-lint.el | 4 ++--
lisp/org-list.el | 6 +++---
lisp/org-src.el | 4 ++--
lisp/org-table.el | 4 ++--
lisp/org.el | 18 +++++++++---------
lisp/ox-ascii.el | 8 ++++----
lisp/ox-beamer.el | 2 +-
lisp/ox-html.el | 6 +++---
lisp/ox-latex.el | 6 +++---
lisp/ox-odt.el | 15 ++++++++-------
lisp/ox-org.el | 2 +-
lisp/ox-publish.el | 2 +-
lisp/ox-texinfo.el | 8 ++++----
lisp/ox.el | 18 +++++++++---------
testing/lisp/test-org-element.el | 2 +-
testing/lisp/test-ox.el | 4 ++--
24 files changed, 75 insertions(+), 67 deletions(-)
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index d150c1e2bf..67b48931a6 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -458,7 +458,11 @@ code blocks by target file."
(org-babel-map-src-blocks (buffer-file-name)
(let ((current-heading-pos
(if (org-element--cache-active-p)
- (or (org-element-property :begin (org-element-lineage
(org-element-at-point) '(headline) t)) 1)
+ (or (org-element-property
+ :begin (org-element-lineage
+ (org-element-at-point)
+ 'headline t))
+ 1)
(org-with-wide-buffer
(org-with-limited-levels (outline-previous-heading))))))
(if (eq last-heading-pos current-heading-pos) (cl-incf counter)
diff --git a/lisp/oc.el b/lisp/oc.el
index 829902e79f..2d5ecd1000 100644
--- a/lisp/oc.el
+++ b/lisp/oc.el
@@ -955,8 +955,9 @@ the sole contents of the footnote, e.g., after calling
`org-cite-wrap-citation'.
When non-nil, the return value if the footnote container."
(let ((footnote
- (org-element-lineage citation
- '(footnote-definition footnote-reference))))
+ (org-element-lineage
+ citation
+ '(footnote-definition footnote-reference))))
(and footnote
(or (not strict)
(equal (org-element-contents (org-element-parent citation))
diff --git a/lisp/ol.el b/lisp/ol.el
index 6420fa4a73..a8afcac557 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1293,7 +1293,7 @@ of matched result, which is either `dedicated' or
`fuzzy'."
(<= (match-end 3) (point)))
(org-element-lineage
(save-match-data (org-element-context))
- '(link) t)))
+ 'link t)))
(goto-char (match-beginning 0))
(setq type 'fuzzy)
(throw :fuzzy-match t)))
@@ -1472,7 +1472,7 @@ is non-nil, move backward."
(let ((context (save-excursion
(unless search-backward (forward-char -1))
(org-element-context))))
- (pcase (org-element-lineage context '(link) t)
+ (pcase (org-element-lineage context 'link t)
(`nil nil)
(link
(goto-char (org-element-property :begin link))
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 444eb8c5bc..c8c4dde123 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1272,7 +1272,7 @@ may have been stored before."
(catch :found
(while (re-search-forward item-regexp end t)
(when (setq item (org-element-lineage
- (org-element-at-point) '(plain-list) t))
+ (org-element-at-point) 'plain-list t))
(goto-char (org-element-property (if prepend? :post-affiliated
:contents-end)
item))
@@ -1377,7 +1377,7 @@ may have been stored before."
;; Narrow to the table, possibly creating one if necessary.
(catch :found
(while (re-search-forward org-table-dataline-regexp end t)
- (pcase (org-element-lineage (org-element-at-point) '(table) t)
+ (pcase (org-element-lineage (org-element-at-point) 'table t)
(`nil nil)
((pred (lambda (e) (eq 'table.el (org-element-property :type e))))
nil)
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index edbbcdebb6..30469fe742 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -1422,7 +1422,7 @@ ELEMENT is the element at point."
;; Ignore checks in LOGBOOK (or equivalent) drawer.
((let ((log (org-log-into-drawer)))
(and log
- (let ((drawer (org-element-lineage element '(drawer))))
+ (let ((drawer (org-element-lineage element 'drawer)))
(and drawer
(org-string-equal-ignore-case
log (org-element-property :drawer-name drawer))))))
diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el
index 0201a0b55b..d508baa119 100644
--- a/lisp/org-cycle.el
+++ b/lisp/org-cycle.el
@@ -388,7 +388,7 @@ same as `S-TAB') also when called without prefix argument."
((org-fold-hide-drawer-toggle nil t element))
;; Table: enter it or move to the next field.
((and (org-match-line "[ \t]*[|+]")
- (org-element-lineage element '(table) t))
+ (org-element-lineage element 'table t))
(if (and (org-element-type-p element 'table)
(eq 'table.el (org-element-property :type element)))
(message (substitute-command-keys "\\<org-mode-map>\
diff --git a/lisp/org-element-ast.el b/lisp/org-element-ast.el
index f191186bc9..88efa734be 100644
--- a/lisp/org-element-ast.el
+++ b/lisp/org-element-ast.el
@@ -1043,8 +1043,9 @@ When DATUM is `plain-text', all the properties are
removed."
DATUM is an object or element.
Return ancestors from the closest to the farthest. When optional
-argument TYPES is a list of symbols, return the first element or
-object in the lineage whose type belongs to that list instead.
+argument TYPES is a symbol or a list of symbols, return the first
+element or object in the lineage whose type equals or belongs to that
+list instead.
When optional argument WITH-SELF is non-nil, lineage includes
DATUM itself as the first element, and TYPES, if provided, also
@@ -1054,6 +1055,7 @@ When DATUM is obtained through `org-element-context' or
`org-element-at-point', and org-element-cache is disabled, only
ancestors from its section can be found. There is no such limitation
when DATUM belongs to a full parse tree."
+ (when (and types (not (listp types))) (setq types (list types)))
(let ((up (if with-self datum (org-element-parent datum)))
ancestors)
(while (and up (not (org-element-type-p up types)))
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 29acd32ff7..bb9af9a1c4 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -224,7 +224,7 @@ defined locally.
The return value is nil if not at a footnote definition, and
a list with label, start, end and definition of the footnote
otherwise."
- (pcase (org-element-lineage (org-element-at-point) '(footnote-definition) t)
+ (pcase (org-element-lineage (org-element-at-point) 'footnote-definition t)
(`nil nil)
(definition
(let* ((label (org-element-property :label definition))
@@ -376,7 +376,7 @@ References are sorted according to a deep-reading order."
(and (eq (org-element-property :type object) 'inline)
(- (org-element-property :contents-end object)
(org-element-property :contents-begin object)))))
- (let ((d (org-element-lineage object '(footnote-definition))))
+ (let ((d (org-element-lineage object 'footnote-definition)))
(push (list label (copy-marker begin) (not d) size)
references)
(when d
diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index da77ba52cb..5c6b78c522 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -600,7 +600,7 @@ Use :header-args: instead"
(org-element-map ast 'drawer
(lambda (d)
(when (equal (org-element-property :drawer-name d) "PROPERTIES")
- (let ((headline? (org-element-lineage d '(headline)))
+ (let ((headline? (org-element-lineage d 'headline))
(before
(mapcar #'org-element-type
(assq d (reverse (org-element-contents
@@ -635,7 +635,7 @@ Use :header-args: instead"
(and (not (file-remote-p file))
(not (file-exists-p file))
(list (org-element-property :begin l)
- (format (if (org-element-lineage l '(link))
+ (format (if (org-element-lineage l 'link)
"Link to non-existent image file %S \
in description"
"Link to non-existent local file %S")
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 684e733ed5..c59083cdb7 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2382,7 +2382,7 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is
;; Check we're really on a line with a bullet.
(when (org-element-type-p e '(item plain-list))
;; Look for ATTR_ORG attribute in the current plain list.
- (let ((plain-list (org-element-lineage e '(plain-list) t)))
+ (let ((plain-list (org-element-lineage e 'plain-list t)))
(org-with-point-at (org-element-property :post-affiliated plain-list)
(let ((case-fold-search t)
(regexp "^[ \t]*#\\+attr_org:.* :radio \\(\\S-+\\)")
@@ -2606,7 +2606,7 @@ With optional prefix argument ALL, do this for the whole
buffer."
;; Skip whole list since we have its
;; structure anyway.
(while (setq element (org-element-lineage
- element '(plain-list)))
+ element 'plain-list))
(goto-char
(min (org-element-property :end element)
end))))))
@@ -3219,7 +3219,7 @@ With a prefix argument ARG, change the region in a single
item."
:end
(org-element-lineage
(org-element-at-point (1- end))
- '(plain-list) t)))
+ 'plain-list t)))
;; Insert footnote definitions after the list.
(unless (bolp) (beginning-of-line 2))
;; At (point-max).
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 2d850e9000..357ad84691 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -1088,7 +1088,7 @@ A coderef format regexp can only match at the end of a
line."
;; If footnote reference belongs to a table, make sure to
;; remove any newline characters in order to preserve
;; table's structure.
- (when (org-element-lineage definition '(table-cell))
+ (when (org-element-lineage definition 'table-cell)
(while (search-forward "\n" nil t) (replace-match " ")))))
contents
'remote))
@@ -1154,7 +1154,7 @@ Throw an error when not at such a table."
;; If within a table a newline would disrupt the structure,
;; so remove newlines.
(goto-char (point-min))
- (when (org-element-lineage context '(table-cell))
+ (when (org-element-lineage context 'table-cell)
(while (search-forward "\n" nil t) (replace-match " "))))
contents))
t))
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 0e615f8355..ebb09be3f5 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -761,7 +761,7 @@ Field is restored even in case of abnormal exit."
If TABLE-TYPE is non-nil, also check for table.el-type tables."
(and (org-match-line (if table-type "[ \t]*[|+]" "[ \t]*|"))
(or (not (derived-mode-p 'org-mode))
- (let ((e (org-element-lineage (org-element-at-point) '(table) t)))
+ (let ((e (org-element-lineage (org-element-at-point) 'table t)))
(and e (or table-type
(eq 'org (org-element-property :type e))))))))
@@ -4259,7 +4259,7 @@ beginning and end position of the current table."
"Apply function F to the start of all tables in the buffer."
(org-with-point-at 1
(while (re-search-forward org-table-line-regexp nil t)
- (let ((table (org-element-lineage (org-element-at-point) '(table) t)))
+ (let ((table (org-element-lineage (org-element-at-point) 'table t)))
(when table
(unless quietly
(message "Mapping tables: %d%%"
diff --git a/lisp/org.el b/lisp/org.el
index fd991abd21..e747efabba 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7274,7 +7274,7 @@ Use the command `\\[widen]' to see the whole buffer
again."
(if (org-element--cache-active-p)
(let* ((heading (org-element-lineage
(or element (org-element-at-point))
- '(headline) t))
+ 'headline t))
(end (org-element-property :end heading)))
(if (and heading end)
(narrow-to-region (org-element-property :begin heading)
@@ -16472,7 +16472,7 @@ buffer boundaries with possible narrowing."
(while (re-search-forward file-types-re end t)
(let* ((link (org-element-lineage
(save-match-data (org-element-context))
- '(link) t))
+ 'link t))
(linktype (org-element-property :type link))
(inner-start (match-beginning 1))
(path
@@ -16566,7 +16566,7 @@ buffer boundaries with possible narrowing."
((eq org-image-actual-width t) nil)
((listp org-image-actual-width)
(let* ((case-fold-search t)
- (par (org-element-lineage link '(paragraph)))
+ (par (org-element-lineage link 'paragraph))
(attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)")
(par-end (org-element-property :post-affiliated par))
;; Try to find an attribute providing a :width.
@@ -17982,7 +17982,7 @@ object (e.g., within a comment). In these case, you
need to use
(when string (save-excursion (insert (org-trim string))))))
;; In a list, make sure indenting keeps trailing text within.
((and (not (eolp))
- (org-element-lineage context '(item)))
+ (org-element-lineage context 'item))
(let ((trailing-data
(delete-and-extract-region (point) (line-end-position))))
(org--newline indent arg interactive)
@@ -20330,7 +20330,7 @@ depending on context."
(interactive)
(let* ((element (org-element-at-point))
(contents-begin (org-element-property :contents-begin element))
- (table (org-element-lineage element '(table) t)))
+ (table (org-element-lineage element 'table t)))
(if (and table
(> (point) contents-begin)
(<= (point) (org-element-property :contents-end table)))
@@ -20355,7 +20355,7 @@ depending on context."
(call-interactively #'forward-sentence))
(let* ((element (org-element-at-point))
(contents-end (org-element-property :contents-end element))
- (table (org-element-lineage element '(table) t)))
+ (table (org-element-lineage element 'table t)))
(if (and table
(>= (point) (org-element-property :contents-begin table))
(< (point) contents-end))
@@ -20569,7 +20569,7 @@ instead of back to heading."
Respect narrowing."
(let ((cached (org-element-at-point nil 'cached)))
(if cached
- (let ((cached-headline (org-element-lineage cached '(headline) t)))
+ (let ((cached-headline (org-element-lineage cached 'headline t)))
(or (not cached-headline)
(< (org-element-property :begin cached-headline) (point-min))))
(org-with-limited-levels
@@ -20692,7 +20692,7 @@ make a significant difference in outlines with very
many siblings."
(org-element-at-point nil t))))
(if element
(let* ((current-heading (org-element-lineage element '(headline
inlinetask) 'with-self))
- (parent (org-element-lineage current-heading '(headline))))
+ (parent (org-element-lineage current-heading 'headline)))
(if (and parent
(<= (point-min) (org-element-property :begin parent)))
(progn
@@ -21092,7 +21092,7 @@ Function may return a real element, or a pseudo-element
with type
(list begin end (org-element-parent e))))
;; Find the full plain list containing point, the check it
;; contains exactly one line per item.
- ((let ((l (org-element-lineage e '(plain-list) t)))
+ ((let ((l (org-element-lineage e 'plain-list t)))
(while (org-element-type-p
(org-element-parent l)
'(item plain-list))
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index a9e588bfa1..e7d44f84a3 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -581,7 +581,7 @@ INFO is a plist used as a communication channel."
;; No inlinetask: Remove global margin from text width.
(- (plist-get info :ascii-text-width)
(plist-get info :ascii-global-margin)
- (let ((parent (org-export-get-parent-headline element)))
+ (let ((parent (org-element-lineage element 'headline)))
;; Inner margin doesn't apply to text before first
;; headline.
(if (not parent) 0
@@ -1419,7 +1419,7 @@ of the parameters."
(make-string width (if utf8p ?━ ?_)))
;; Flush the inlinetask to the right.
(- (plist-get info :ascii-text-width) (plist-get info
:ascii-global-margin)
- (if (not (org-export-get-parent-headline inlinetask)) 0
+ (if (not (org-element-lineage inlinetask 'headline)) 0
(plist-get info :ascii-inner-margin))
(org-ascii--current-text-width inlinetask info)))))
@@ -1760,7 +1760,7 @@ contextual information."
(let ((links
(and (plist-get info :ascii-links-to-notes)
;; Take care of links in first section of the document.
- (not (org-element-lineage section '(headline)))
+ (not (org-element-lineage section 'headline))
(org-ascii--describe-links
(org-ascii--unique-links section info)
(org-ascii--current-text-width section info)
@@ -1769,7 +1769,7 @@ contextual information."
(if (not (org-string-nw-p links)) contents
(concat (org-element-normalize-string contents) "\n\n" links))
;; Do not apply inner margin if parent headline is low level.
- (let ((headline (org-export-get-parent-headline section)))
+ (let ((headline (org-element-lineage section 'headline)))
(if (or (not headline) (org-export-low-level-p headline info)) 0
(plist-get info :ascii-inner-margin))))))
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index c2aa70aeb7..c58b0c6bcf 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -517,7 +517,7 @@ used as a communication channel."
;; when there is no previous headline or the previous
;; headline do not have a BEAMER_column property.
(parent-env (org-element-property
- :BEAMER_ENV (org-export-get-parent-headline headline)))
+ :BEAMER_ENV (org-element-lineage headline 'headline)))
(start-columns-p
(or (equal environment "columns")
(and column-width
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index ff0dac8441..ef6f25c69d 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -3554,7 +3554,7 @@ holding contextual information."
"Transcode a SECTION element from Org to HTML.
CONTENTS holds the contents of the section. INFO is a plist
holding contextual information."
- (let ((parent (org-export-get-parent-headline section)))
+ (let ((parent (org-element-lineage section 'headline)))
;; Before first headline: no container, just return CONTENTS.
(if (not parent) contents
;; Get div's class and id references.
@@ -3692,7 +3692,7 @@ contextual information."
CONTENTS is nil. INFO is a plist used as a communication
channel."
(let* ((table-row (org-element-parent table-cell))
- (table (org-export-get-parent-table table-cell))
+ (table (org-element-lineage table-cell 'table))
(cell-attrs
(if (not (plist-get info :html-table-align-individual-fields)) ""
(format (if (and (boundp 'org-html-format-table-no-css)
@@ -3756,7 +3756,7 @@ communication channel."
((not (= 1 group)) '("<tbody>" . "\n</tbody>"))
;; Row is from first group. Table has >=1 groups.
((org-export-table-has-header-p
- (org-export-get-parent-table table-row) info)
+ (org-element-lineage table-row 'table) info)
'("<thead>" . "\n</thead>"))
;; Row is from first and only group.
(t '("<tbody>" . "\n</tbody>")))))
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 8f8feb4ce8..ec180e510c 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2596,7 +2596,7 @@ CONTENTS is nil. INFO is a plist holding contextual
information."
(cond
((string-match-p "\\<headlines\\>" value)
(let* ((localp (string-match-p "\\<local\\>" value))
- (parent (org-element-lineage keyword '(headline)))
+ (parent (org-element-lineage keyword 'headline))
(level (if (not (and localp parent)) 0
(org-export-get-relative-level parent info)))
(depth
@@ -3983,7 +3983,7 @@ This function assumes TABLE has `org' as its `:type'
property and
CONTENTS is the cell contents. INFO is a plist used as
a communication channel."
(let ((type (org-export-read-attribute
- :attr_latex (org-export-get-parent-table table-cell) :mode))
+ :attr_latex (org-element-lineage table-cell 'table) :mode))
(scientific-format (plist-get info :latex-table-scientific-notation)))
(concat
(if (and contents
@@ -4033,7 +4033,7 @@ a communication channel."
;; Special case for long tables. Define header and footers.
((and longtablep (org-export-table-row-ends-header-p table-row info))
(let ((columns (cdr (org-export-table-dimensions
- (org-export-get-parent-table table-row) info))))
+ (org-element-lineage table-row 'table) info))))
(format "%s
\\endfirsthead
\\multicolumn{%d}{l}{%s} \\\\[0pt]
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 9c6e79a9b9..64ffd3af46 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -1797,8 +1797,8 @@ holding contextual information."
;; If top-level list, re-start numbering. Otherwise,
;; continue numbering.
(format "text:continue-numbering=\"%s\""
- (let* ((parent (org-export-get-parent-headline
- headline)))
+ (let* ((parent (org-element-lineage
+ headline 'headline)))
(if (and parent
(org-export-low-level-p parent info))
"true" "false")))))
@@ -3231,7 +3231,8 @@ contextual information."
;;;; Table Cell
(defun org-odt-table-style-spec (element info)
- (let* ((table (org-export-get-parent-table element))
+ "Get table style from `:odt-table-styles' INFO property."
+ (let* ((table (org-element-lineage element 'table))
(table-attributes (org-export-read-attribute :attr_odt table))
(table-style (plist-get table-attributes :style)))
(assoc table-style (plist-get info :odt-table-styles))))
@@ -3256,7 +3257,7 @@ styles congruent with the ODF-1.2 specification."
(r (car table-cell-address)) (c (cdr table-cell-address))
(style-spec (org-odt-table-style-spec table-cell info))
(table-dimensions (org-export-table-dimensions
- (org-export-get-parent-table table-cell)
+ (org-element-lineage table-cell 'table)
info)))
(when style-spec
;; LibreOffice - particularly the Writer - honors neither table
@@ -3314,9 +3315,9 @@ channel."
(cond
((and (= 1 (org-export-table-row-group table-row info))
(org-export-table-has-header-p
- (org-export-get-parent-table table-row) info))
+ (org-element-lineage table-row 'table) info))
"OrgTableHeading")
- ((let* ((table (org-export-get-parent-table table-cell))
+ ((let* ((table (org-element-lineage table-cell 'table))
(table-attrs (org-export-read-attribute :attr_odt table))
(table-header-columns
(let ((cols (plist-get table-attrs :header-columns)))
@@ -3374,7 +3375,7 @@ communication channel."
(let* ((rowgroup-tags
(if (and (= 1 (org-export-table-row-group table-row info))
(org-export-table-has-header-p
- (org-export-get-parent-table table-row) info))
+ (org-element-lineage table-row 'table) info))
;; If the row belongs to the first rowgroup and the
;; table has more than one row groups, then this row
;; belongs to the header row group.
diff --git a/lisp/ox-org.el b/lisp/ox-org.el
index 6aef03ed91..b584c60e2d 100644
--- a/lisp/ox-org.el
+++ b/lisp/ox-org.el
@@ -226,7 +226,7 @@ a communication channel."
;; them are included in the result.
(let ((footnotes
(org-element-map
- (list (org-export-get-parent-headline section) section)
+ (list (org-element-lineage section 'headline) section)
'footnote-reference
(lambda (fn)
(and (eq (org-element-property :type fn) 'standard)
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index 5c9bf5f895..3c7311b56d 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -1042,7 +1042,7 @@ its CDR is a string."
(org-element-map (plist-get info :parse-tree) 'keyword
(lambda (k)
(when (equal (org-element-property :key k) "INDEX")
- (let ((parent (org-export-get-parent-headline k)))
+ (let ((parent (org-element-lineage k 'headline)))
(list (org-element-property :value k)
file
(cond
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index ad10387a29..450856cd61 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -557,7 +557,7 @@ node or anchor name is unique."
;; Consequently, we ensure that every parent headline gets
;; its node beforehand. As a recursive operation, this
;; achieves the desired effect.
- (let ((parent (org-element-lineage datum '(headline))))
+ (let ((parent (org-element-lineage datum 'headline)))
(when (and parent (not (assq parent cache)))
(org-texinfo--get-node parent info)
(setq cache (plist-get info :texinfo-node-cache))))
@@ -1352,7 +1352,7 @@ INFO is a plist holding contextual information. See
(org-element-type-p
(org-element-parent destination)
'headline))))
- (let ((headline (org-element-lineage destination '(headline) t)))
+ (let ((headline (org-element-lineage destination 'headline t)))
(org-texinfo--@ref headline desc info)))
(_ (org-texinfo--@ref destination desc info)))))
((string= type "mailto")
@@ -1651,7 +1651,7 @@ contextual information."
"Transcode a SECTION element from Org to Texinfo.
CONTENTS holds the contents of the section. INFO is a plist
holding contextual information."
- (let ((parent (org-export-get-parent-headline section)))
+ (let ((parent (org-element-lineage section 'headline)))
(when parent ;first section is handled in `org-texinfo-template'
(org-trim
(concat contents
@@ -1808,7 +1808,7 @@ a communication channel."
(let ((rowgroup-tag
(if (and (= 1 (org-export-table-row-group table-row info))
(org-export-table-has-header-p
- (org-export-get-parent-table table-row) info))
+ (org-element-lineage table-row 'table) info))
"@headitem "
"@item ")))
(concat rowgroup-tag contents "\n"))))
diff --git a/lisp/ox.el b/lisp/ox.el
index d33520aee3..a807631e56 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1843,7 +1843,7 @@ not exported."
(table (not (plist-get options :with-tables)))
(table-cell
(and (org-export-table-has-special-column-p
- (org-export-get-parent-table datum))
+ (org-element-lineage datum 'table))
(org-export-first-sibling-p datum options)))
(table-row (org-export-table-row-is-special-p datum options))
(timestamp
@@ -2966,7 +2966,7 @@ containing their first reference."
d))
definitions)))
(org-element-adopt
- (org-element-lineage reference '(section))
+ (org-element-lineage reference 'section)
definition)
;; Also insert definitions for nested
;; references, if any.
@@ -4256,7 +4256,7 @@ inherited from a parent headline.
Return value is a string or nil."
(let ((headline (if (org-element-type-p datum 'headline) datum
- (org-export-get-parent-headline datum))))
+ (org-element-lineage datum 'headline))))
(if (not inherited) (org-element-property property datum)
(org-element-property-inherited property headline 'with-self nil nil
t))))
@@ -5359,7 +5359,7 @@ row (resp. last row) of the table, ignoring table rules,
if any.
Returned borders ignore special rows."
(let* ((row (org-element-parent table-cell))
- (table (org-export-get-parent-table table-cell))
+ (table (org-element-lineage table-cell 'table))
borders)
;; Top/above border? TABLE-CELL has a border above when a rule
;; used to demarcate row groups can be found above. Hence,
@@ -5476,7 +5476,7 @@ INFO is a plist used as a communication channel."
INFO is a plist used as a communication channel. Always return
nil for special rows and rows separators."
(and (org-export-table-has-header-p
- (org-export-get-parent-table table-row) info)
+ (org-element-lineage table-row 'table) info)
(eql (org-export-table-row-group table-row info) 1)))
(defun org-export-table-row-starts-header-p (table-row info)
@@ -5506,7 +5506,7 @@ for special rows and separators."
;; First time a row is queried, populate cache with all the
;; rows from the table.
(let ((number -1))
- (org-element-map (org-export-get-parent-table table-row) 'table-row
+ (org-element-map (org-element-lineage table-row 'table) 'table-row
(lambda (row)
(when (eq (org-element-property :type row) 'standard)
(puthash row (cl-incf number) cache)))
@@ -5613,7 +5613,7 @@ Return a list of all exportable headlines as parsed
elements.
Footnote sections are ignored."
(let* ((scope (cond ((not scope) (plist-get info :parse-tree))
((org-element-type-p scope 'headline) scope)
- ((org-export-get-parent-headline scope))
+ ((org-element-lineage scope 'headline))
(t (plist-get info :parse-tree))))
(limit (plist-get info :headline-levels))
(n (if (not (wholenump n)) limit
@@ -6039,12 +6039,12 @@ Return the new string."
(defun org-export-get-parent-headline (blob)
"Return BLOB parent headline or nil.
BLOB is the element or object being considered."
- (org-element-lineage blob '(headline)))
+ (org-element-lineage blob 'headline))
(defun org-export-get-parent-table (object)
"Return OBJECT parent table or nil.
OBJECT is either a `table-cell' or `table-element' type object."
- (org-element-lineage object '(table)))
+ (org-element-lineage object 'table))
(defun org-export-get-previous-element (blob info &optional n)
"Return previous element or object.
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 60caa1cd39..6f5494f4f0 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -3971,7 +3971,7 @@ Text
(org-test-with-temp-text
"* H1\n** H2\n#+BEGIN_CENTER\n*bold<point>*\n#+END_CENTER"
(org-element-type
- (org-element-lineage (org-element-context) '(center-block))))))
+ (org-element-lineage (org-element-context) 'center-block)))))
(should-not
(org-test-with-temp-text
"* H1\n** H2\n#+BEGIN_CENTER\n*bold<point>*\n#+END_CENTER"
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 7d7acdf16f..54a51aa4db 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -2362,7 +2362,7 @@ Para2"
:transcoders
`(,(cons 'footnote-reference
(lambda (f _c i)
- (when (org-element-lineage f '(drawer))
+ (when (org-element-lineage f 'drawer)
(push (org-export-footnote-first-reference-p f i nil)
result))
""))
@@ -2383,7 +2383,7 @@ Para2"
:transcoders
`(,(cons 'footnote-reference
(lambda (f _c i)
- (when (org-element-lineage f '(drawer))
+ (when (org-element-lineage f 'drawer)
(push (org-export-footnote-first-reference-p f i nil t)
result))
""))
- [elpa] externals/org 81e85bda2b 088/101: Fix Emacs 27 compatibility, (continued)
- [elpa] externals/org 81e85bda2b 088/101: Fix Emacs 27 compatibility, ELPA Syncer, 2023/07/01
- [elpa] externals/org e18263fceb 091/101: org-element--substring: Fix when buffer is narrowed, ELPA Syncer, 2023/07/01
- [elpa] externals/org 759676b308 092/101: org-fold-core--isearch-show: Do not fully rely on `point', ELPA Syncer, 2023/07/01
- [elpa] externals/org f2dd1eea41 093/101: org-find-open-clocks: Fix false positives, ELPA Syncer, 2023/07/01
- [elpa] externals/org 37a58cc6ee 094/101: org-agenda-skip: Do not alter match data, ELPA Syncer, 2023/07/01
- [elpa] externals/org 66c8e94732 100/101: lisp/org-element-ast.el: Fix typo in commentary, ELPA Syncer, 2023/07/01
- [elpa] externals/org 948c896448 101/101: Rename `org-element-property-1' to `org-element-property-raw', ELPA Syncer, 2023/07/01
- [elpa] externals/org 932c49c7bb 019/101: org-element-headline-parser: Use deferred properties, ELPA Syncer, 2023/07/01
- [elpa] externals/org 244cc7d560 029/101: org-element-org-data-parser: Defer parsing, ELPA Syncer, 2023/07/01
- [elpa] externals/org b00c2d0e1d 039/101: org-element--parse-to: Provide deferred :parent when cache is inactive, ELPA Syncer, 2023/07/01
- [elpa] externals/org 81a7e8c836 037/101: org-element-lineage: Allow TYPES to be a symbol,
ELPA Syncer <=
- [elpa] externals/org 4d63e571e0 042/101: org-get-tags: Use org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org f225e24869 040/101: org-element--current-element: Make defsubst, ELPA Syncer, 2023/07/01
- [elpa] externals/org dfd36d1969 049/101: org-up-heading-safe: Use element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org fefaadc2d5 050/101: org-element: Optimize working with match data and Emacs regexps, ELPA Syncer, 2023/07/01
- [elpa] externals/org 6266197bbd 051/101: org-at-item-p: Use org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org 6938857369 052/101: org-goto-first-child: Switch to org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org 7c549f4841 060/101: org-babel-tangle-collect-blocks: Switch to org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org b2482d9cc4 070/101: * testing/lisp/test-org-element.el: Add new tests, ELPA Syncer, 2023/07/01
- [elpa] externals/org b0a2deaec6 073/101: org-element--current-element: Faster property drawer check, ELPA Syncer, 2023/07/01
- [elpa] externals/org 110601ce74 074/101: org-element--current-element: Add FIXME, ELPA Syncer, 2023/07/01