Browse Source

org-export: Rewrite topology functions

* contrib/lisp/org-export.el (org-export-get-genealogy,
  org-export-get-parent, org-export-get-parent-headline,
  org-export-get-parent-table): Rewrite function to use :parent
  property.  Remove communication channel from signature.
(org-export-get-parent-element): Rename from
`org-export-get-parent-paragraph'.
(org-export-data, org-export-table-row-is-special-p)
org-export-table-row-group, org-export-table-cell-starts-colgroup-p,
org-export-table-cell-ends-colgroup-p,
org-export-table-row-starts-header-p,
org-export-table-row-ends-header-p, org-export-table-cell-address,
org-export-first-sibling-p, org-export-last-sibling-p,
org-export-resolve-fuzzy-link, org-export-get-ordinal): Apply
signature change.
(org-export--skip-p, org-export-table-cell-width,
org-export-table-cell-alignment, org-export-table-cell-borders):
Refactor code.  Apply signature change.
* contrib/lisp/org-e-ascii.el (org-e-ascii--current-text-width,
  org-e-ascii--unique-links, org-e-ascii-inlinetask,
  org-e-ascii-item, org-e-ascii-paragraph, org-e-ascii-quote-section,
  org-e-ascii-section, org-e-ascii--table-cell-width): Apply signature
  change.
* contrib/lisp/org-e-html.el (org-e-html-link,
  org-e-html-link--inline-image): Use new function and apply signature
  change.
(org-e-html-item, org-e-html-standalone-image-p, org-e-html-paragraph,
org-e-html-section, org-e-html-table-cell, org-e-html-table-row,
org-e-html-footnote-reference): Apply signature change.
* contrib/lisp/org-e-latex.el (org-e-latex-link--inline-image): Use
  new function and apply signature change.
(org-e-latex-footnote-reference, org-e-latex-item,
org-e-latex-table-cell, org-e-latex-table-row): Apply signature
change.
* contrib/lisp/org-e-odt.el (org-e-odt-format-formula,
  org-e-odt-format-label, org-e-odt-link--inline-image): Use new
  function and apply signature change.
(org-e-odt-item, org-e-odt-standalone-image-p, org-e-odt-paragraph,
org-e-odt-plain-list, org-e-odt-table-style-spec,
org-e-odt-get-table-cell-styles, org-e-odt-table-cell,
org-e-odt-table-row, org-e-odt-table, org-e-odt-footnote-reference,
org-e-odt-enumerate-element): Apply signature change.
Nicolas Goaziou 13 years ago
parent
commit
4728a4611e

+ 10 - 10
contrib/lisp/org-e-ascii.el

@@ -53,7 +53,7 @@
 (declare-function org-export-get-headline-number "org-export" (headline info))
 (declare-function org-export-get-headline-number "org-export" (headline info))
 (declare-function org-export-get-ordinal "org-export"
 (declare-function org-export-get-ordinal "org-export"
 		  (element info &optional types predicate))
 		  (element info &optional types predicate))
-(declare-function org-export-get-parent-headline "org-export" (blob info))
+(declare-function org-export-get-parent-headline "org-export" (blob))
 (declare-function org-export-get-relative-level "org-export" (headline info))
 (declare-function org-export-get-relative-level "org-export" (headline info))
 (declare-function org-export-low-level-p "org-export" (headline info))
 (declare-function org-export-low-level-p "org-export" (headline info))
 (declare-function org-export-output-file-name "org-export"
 (declare-function org-export-output-file-name "org-export"
@@ -564,7 +564,7 @@ INFO is a plist used as a communication channel."
     ;; Elements with a relative width: store maximum text width in
     ;; Elements with a relative width: store maximum text width in
     ;; TOTAL-WIDTH.
     ;; TOTAL-WIDTH.
     (otherwise
     (otherwise
-     (let* ((genealogy (cons element (org-export-get-genealogy element info)))
+     (let* ((genealogy (cons element (org-export-get-genealogy element)))
 	    ;; Total width is determined by the presence, or not, of an
 	    ;; Total width is determined by the presence, or not, of an
 	    ;; inline task among ELEMENT parents.
 	    ;; inline task among ELEMENT parents.
 	    (total-width
 	    (total-width
@@ -574,7 +574,7 @@ INFO is a plist used as a communication channel."
 	       ;; No inlinetask: Remove global margin from text width.
 	       ;; No inlinetask: Remove global margin from text width.
 	       (- org-e-ascii-text-width
 	       (- org-e-ascii-text-width
 		  org-e-ascii-global-margin
 		  org-e-ascii-global-margin
-		  (let ((parent (org-export-get-parent-headline element info)))
+		  (let ((parent (org-export-get-parent-headline element)))
 		    ;; Inner margin doesn't apply to text before first
 		    ;; Inner margin doesn't apply to text before first
 		    ;; headline.
 		    ;; headline.
 		    (if (not parent) 0
 		    (if (not parent) 0
@@ -830,7 +830,7 @@ is a plist used as a communication channel."
 	 ;; count links that might be in the title.
 	 ;; count links that might be in the title.
 	 (headline
 	 (headline
 	  (if (eq (org-element-type element) 'headline) element
 	  (if (eq (org-element-type element) 'headline) element
-	    (or (org-export-get-parent-headline element info) element))))
+	    (or (org-export-get-parent-headline element) element))))
     ;; Get all links in HEADLINE.
     ;; Get all links in HEADLINE.
     (org-element-map
     (org-element-map
      headline 'link (lambda (link) (funcall unique-link-p link)) info)))
      headline 'link (lambda (link) (funcall unique-link-p link)) info)))
@@ -1306,7 +1306,7 @@ holding contextual information."
 	  (make-string width (if utf8p ?━ ?_)))
 	  (make-string width (if utf8p ?━ ?_)))
 	 ;; Flush the inlinetask to the right.
 	 ;; Flush the inlinetask to the right.
 	 (- org-e-ascii-text-width org-e-ascii-global-margin
 	 (- org-e-ascii-text-width org-e-ascii-global-margin
-	    (if (not (org-export-get-parent-headline inlinetask info)) 0
+	    (if (not (org-export-get-parent-headline inlinetask)) 0
 	      org-e-ascii-inner-margin)
 	      org-e-ascii-inner-margin)
 	    (org-e-ascii--current-text-width inlinetask info)))))))
 	    (org-e-ascii--current-text-width inlinetask info)))))))
 
 
@@ -1329,7 +1329,7 @@ contextual information."
 	 ;; First parent of ITEM is always the plain-list.  Get
 	 ;; First parent of ITEM is always the plain-list.  Get
 	 ;; `:type' property from it.
 	 ;; `:type' property from it.
 	 (org-list-bullet-string
 	 (org-list-bullet-string
-	  (case (org-element-property :type (org-export-get-parent item info))
+	  (case (org-element-property :type (org-export-get-parent item))
 	    (descriptive
 	    (descriptive
 	     (concat (org-export-data (org-element-property :tag item) info)
 	     (concat (org-export-data (org-element-property :tag item) info)
 		     ": "))
 		     ": "))
@@ -1473,7 +1473,7 @@ information."
 CONTENTS is the contents of the paragraph, as a string.  INFO is
 CONTENTS is the contents of the paragraph, as a string.  INFO is
 the plist used as a communication channel."
 the plist used as a communication channel."
   (org-e-ascii--fill-string
   (org-e-ascii--fill-string
-   (let ((parent (org-export-get-parent paragraph info)))
+   (let ((parent (org-export-get-parent paragraph)))
      ;; If PARAGRAPH is the first one in a list element, be sure to
      ;; If PARAGRAPH is the first one in a list element, be sure to
      ;; add the check-box in front of it, before any filling.  Later,
      ;; add the check-box in front of it, before any filling.  Later,
      ;; it would interfere with line width.
      ;; it would interfere with line width.
@@ -1567,7 +1567,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
      value
      value
      (+ org-e-ascii-quote-margin
      (+ org-e-ascii-quote-margin
 	;; Don't apply inner margin if parent headline is low level.
 	;; Don't apply inner margin if parent headline is low level.
-	(let ((headline (org-export-get-parent-headline quote-section info)))
+	(let ((headline (org-export-get-parent-headline quote-section)))
 	  (if (org-export-low-level-p headline info) 0
 	  (if (org-export-low-level-p headline info) 0
 	    org-e-ascii-inner-margin))))))
 	    org-e-ascii-inner-margin))))))
 
 
@@ -1597,7 +1597,7 @@ contextual information."
 	;; Separate list of links and section contents.
 	;; Separate list of links and section contents.
 	(when (org-string-nw-p links) (concat "\n\n" links)))))
 	(when (org-string-nw-p links) (concat "\n\n" links)))))
    ;; Do not apply inner margin if parent headline is low level.
    ;; Do not apply inner margin if parent headline is low level.
-   (let ((headline (org-export-get-parent-headline section info)))
+   (let ((headline (org-export-get-parent-headline section)))
      (if (or (not headline) (org-export-low-level-p headline info)) 0
      (if (or (not headline) (org-export-low-level-p headline info)) 0
        org-e-ascii-inner-margin))))
        org-e-ascii-inner-margin))))
 
 
@@ -1698,7 +1698,7 @@ are ignored."
   (or (and (not org-e-ascii-table-widen-columns)
   (or (and (not org-e-ascii-table-widen-columns)
 	   (org-export-table-cell-width table-cell info))
 	   (org-export-table-cell-width table-cell info))
       (let* ((max-width 0)
       (let* ((max-width 0)
-	     (table (org-export-get-parent-table table-cell info))
+	     (table (org-export-get-parent-table table-cell))
 	     (specialp (org-export-table-has-special-column-p table))
 	     (specialp (org-export-table-has-special-column-p table))
 	     (col (cdr (org-export-table-cell-address table-cell info))))
 	     (col (cdr (org-export-table-cell-address table-cell info))))
 	(org-element-map
 	(org-element-map

+ 10 - 10
contrib/lisp/org-e-html.el

@@ -2022,7 +2022,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 CONTENTS is nil.  INFO is a plist holding contextual information."
 CONTENTS is nil.  INFO is a plist holding contextual information."
   (concat
   (concat
    ;; Insert separator between two footnotes in a row.
    ;; Insert separator between two footnotes in a row.
-   (let ((prev (org-export-get-previous-element footnote-reference info)))
+   (let ((prev (org-export-get-previous-element footnote-reference)))
      (when (eq (org-element-type prev) 'footnote-reference)
      (when (eq (org-element-type prev) 'footnote-reference)
        org-e-html-footnote-separator))
        org-e-html-footnote-separator))
    (cond
    (cond
@@ -2261,7 +2261,7 @@ contextual information."
   "Transcode an ITEM element from Org to HTML.
   "Transcode an ITEM element from Org to HTML.
 CONTENTS holds the contents of the item.  INFO is a plist holding
 CONTENTS holds the contents of the item.  INFO is a plist holding
 contextual information."
 contextual information."
-  (let* ((plain-list (org-export-get-parent item info))
+  (let* ((plain-list (org-export-get-parent item))
 	 (type (org-element-property :type plain-list))
 	 (type (org-element-property :type plain-list))
 	 (counter (org-element-property :counter item))
 	 (counter (org-element-property :counter item))
 	 (checkbox (org-element-property :checkbox item))
 	 (checkbox (org-element-property :checkbox item))
@@ -2382,7 +2382,7 @@ used as a communication channel."
 		     ((file-name-absolute-p raw-path)
 		     ((file-name-absolute-p raw-path)
 		      (expand-file-name raw-path))
 		      (expand-file-name raw-path))
 		     (t raw-path)))
 		     (t raw-path)))
-	 (parent (org-export-get-parent-paragraph link info))
+	 (parent (org-export-get-parent-element link))
 	 (caption (org-e-html--caption/label-string
 	 (caption (org-e-html--caption/label-string
 		   (org-element-property :caption parent)
 		   (org-element-property :caption parent)
 		   (org-element-property :name parent)
 		   (org-element-property :name parent)
@@ -2428,7 +2428,7 @@ standalone images, do the following.
 		     (paragraph element)
 		     (paragraph element)
 		     (link (and (org-export-inline-image-p
 		     (link (and (org-export-inline-image-p
 				 element org-e-html-inline-image-rules)
 				 element org-e-html-inline-image-rules)
-				(org-export-get-parent element info)))
+				(org-export-get-parent element)))
 		     (t nil))))
 		     (t nil))))
     (when paragraph
     (when paragraph
       (assert (eq (org-element-type paragraph) 'paragraph))
       (assert (eq (org-element-type paragraph) 'paragraph))
@@ -2484,7 +2484,7 @@ INFO is a plist holding contextual information.  See
 	  (let ((attr (mapconcat
 	  (let ((attr (mapconcat
 		       'identity
 		       'identity
 		       (org-element-property
 		       (org-element-property
-			:attr_html (org-export-get-parent-paragraph link info))
+			:attr_html (org-export-get-parent-element link))
 		       " ")))
 		       " ")))
 	    (if attr (concat " " attr) "")))
 	    (if attr (concat " " attr) "")))
 	 protocol)
 	 protocol)
@@ -2615,7 +2615,7 @@ the plist used as a communication channel."
 	 (class (cdr (assoc style '((footnote . "footnote")
 	 (class (cdr (assoc style '((footnote . "footnote")
 				    (verse . nil)))))
 				    (verse . nil)))))
 	 (extra (if class (format " class=\"%s\"" class) ""))
 	 (extra (if class (format " class=\"%s\"" class) ""))
-	 (parent (org-export-get-parent paragraph info)))
+	 (parent (org-export-get-parent paragraph)))
     (cond
     (cond
      ((and (equal (org-element-type parent) 'item)
      ((and (equal (org-element-type parent) 'item)
 	   (= (org-element-property :begin paragraph)
 	   (= (org-element-property :begin paragraph)
@@ -2783,7 +2783,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
   "Transcode a SECTION element from Org to HTML.
   "Transcode a SECTION element from Org to HTML.
 CONTENTS holds the contents of the section.  INFO is a plist
 CONTENTS holds the contents of the section.  INFO is a plist
 holding contextual information."
 holding contextual information."
-  (let ((parent (org-export-get-parent-headline section info)))
+  (let ((parent (org-export-get-parent-headline section)))
     ;; Before first headline: no container, just return CONTENTS.
     ;; Before first headline: no container, just return CONTENTS.
     (if (not parent) contents
     (if (not parent) contents
       ;; Get div's class and id references.
       ;; Get div's class and id references.
@@ -2905,8 +2905,8 @@ contextual information."
   "Transcode a TABLE-CELL element from Org to HTML.
   "Transcode a TABLE-CELL element from Org to HTML.
 CONTENTS is nil.  INFO is a plist used as a communication
 CONTENTS is nil.  INFO is a plist used as a communication
 channel."
 channel."
-  (let* ((table-row (org-export-get-parent table-cell info))
-	 (table (org-export-get-parent-table table-cell info))
+  (let* ((table-row (org-export-get-parent table-cell))
+	 (table (org-export-get-parent-table table-cell))
 	 (cell-attrs
 	 (cell-attrs
 	  (if (not org-e-html-table-align-individual-fields) ""
 	  (if (not org-e-html-table-align-individual-fields) ""
 	    (format (if (and (boundp 'org-e-html-format-table-no-css)
 	    (format (if (and (boundp 'org-e-html-format-table-no-css)
@@ -2945,7 +2945,7 @@ communication channel."
 	      '("\n<tbody>" . "\n</tbody>"))
 	      '("\n<tbody>" . "\n</tbody>"))
 	     ;; Case 2: Row is from first rowgroup.  Table has >=1 rowgroups.
 	     ;; Case 2: Row is from first rowgroup.  Table has >=1 rowgroups.
 	     ((org-export-table-has-header-p
 	     ((org-export-table-has-header-p
-	       (org-export-get-parent-table table-row info) info)
+	       (org-export-get-parent-table table-row) info)
 	      '("\n<thead>" . "\n</thead>"))
 	      '("\n<thead>" . "\n</thead>"))
 	     ;; Case 2: Row is from first and only row group.
 	     ;; Case 2: Row is from first and only row group.
 	     (t '("\n<tbody>" . "\n</tbody>")))))
 	     (t '("\n<tbody>" . "\n</tbody>")))))

+ 8 - 8
contrib/lisp/org-e-latex.el

@@ -56,7 +56,7 @@
 (declare-function org-export-get-footnote-definition "org-export"
 (declare-function org-export-get-footnote-definition "org-export"
 		  (footnote-reference info))
 		  (footnote-reference info))
 (declare-function org-export-get-footnote-number "org-export" (footnote info))
 (declare-function org-export-get-footnote-number "org-export" (footnote info))
-(declare-function org-export-get-previous-element "org-export" (blob info))
+(declare-function org-export-get-previous-element "org-export" (blob))
 (declare-function org-export-get-relative-level "org-export" (headline info))
 (declare-function org-export-get-relative-level "org-export" (headline info))
 (declare-function org-export-unravel-code "org-export" (element))
 (declare-function org-export-unravel-code "org-export" (element))
 (declare-function org-export-inline-image-p "org-export"
 (declare-function org-export-inline-image-p "org-export"
@@ -1150,7 +1150,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 CONTENTS is nil.  INFO is a plist holding contextual information."
 CONTENTS is nil.  INFO is a plist holding contextual information."
   (concat
   (concat
    ;; Insert separator between two footnotes in a row.
    ;; Insert separator between two footnotes in a row.
-   (let ((prev (org-export-get-previous-element footnote-reference info)))
+   (let ((prev (org-export-get-previous-element footnote-reference)))
      (when (eq (org-element-type prev) 'footnote-reference)
      (when (eq (org-element-type prev) 'footnote-reference)
        org-e-latex-footnote-separator))
        org-e-latex-footnote-separator))
    (cond
    (cond
@@ -1160,7 +1160,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 	     (org-export-get-footnote-number footnote-reference info)))
 	     (org-export-get-footnote-number footnote-reference info)))
     ;; Use also \footnotemark if reference is within another footnote
     ;; Use also \footnotemark if reference is within another footnote
     ;; reference or footnote definition.
     ;; reference or footnote definition.
-    ((loop for parent in (org-export-get-genealogy footnote-reference info)
+    ((loop for parent in (org-export-get-genealogy footnote-reference)
 	   thereis (memq (org-element-type parent)
 	   thereis (memq (org-element-type parent)
 			 '(footnote-reference footnote-definition)))
 			 '(footnote-reference footnote-definition)))
      (let ((num (org-export-get-footnote-number footnote-reference info)))
      (let ((num (org-export-get-footnote-number footnote-reference info)))
@@ -1408,7 +1408,7 @@ contextual information."
   (let* ((counter
   (let* ((counter
 	  (let ((count (org-element-property :counter item))
 	  (let ((count (org-element-property :counter item))
 		(level
 		(level
-		 (loop for parent in (org-export-get-genealogy item info)
+		 (loop for parent in (org-export-get-genealogy item)
 		       count (eq (org-element-type parent) 'plain-list)
 		       count (eq (org-element-type parent) 'plain-list)
 		       until (eq (org-element-type parent) 'headline))))
 		       until (eq (org-element-type parent) 'headline))))
 	    (and count
 	    (and count
@@ -1501,7 +1501,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
   "Return LaTeX code for an inline image.
   "Return LaTeX code for an inline image.
 LINK is the link pointing to the inline image.  INFO is a plist
 LINK is the link pointing to the inline image.  INFO is a plist
 used as a communication channel."
 used as a communication channel."
-  (let* ((parent (org-export-get-parent-paragraph link info))
+  (let* ((parent (org-export-get-parent-element link))
 	 (path (let ((raw-path (org-element-property :path link)))
 	 (path (let ((raw-path (org-element-property :path link)))
 		 (if (not (file-name-absolute-p raw-path)) raw-path
 		 (if (not (file-name-absolute-p raw-path)) raw-path
 		   (expand-file-name raw-path))))
 		   (expand-file-name raw-path))))
@@ -2179,7 +2179,7 @@ a communication channel."
 		      (match-string 1 contents)
 		      (match-string 1 contents)
 		      (match-string 2 contents))
 		      (match-string 2 contents))
 	    contents)
 	    contents)
-	  (when (org-export-get-next-element table-cell info) " & ")))
+	  (when (org-export-get-next-element table-cell) " & ")))
 
 
 
 
 ;;;; Table Row
 ;;;; Table Row
@@ -2193,7 +2193,7 @@ a communication channel."
   (when (eq (org-element-property :type table-row) 'standard)
   (when (eq (org-element-property :type table-row) 'standard)
     (let* ((attr (mapconcat 'identity
     (let* ((attr (mapconcat 'identity
 			    (org-element-property
 			    (org-element-property
-			     :attr_latex (org-export-get-parent table-row info))
+			     :attr_latex (org-export-get-parent table-row))
 			    " "))
 			    " "))
 	   (longtablep (and attr (string-match "\\<longtable\\>" attr)))
 	   (longtablep (and attr (string-match "\\<longtable\\>" attr)))
 	   (booktabsp
 	   (booktabsp
@@ -2221,7 +2221,7 @@ a communication channel."
 		 (if booktabsp "\\midrule" "\\hline")
 		 (if booktabsp "\\midrule" "\\hline")
 		 ;; Number of columns.
 		 ;; Number of columns.
 		 (cdr (org-export-table-dimensions
 		 (cdr (org-export-table-dimensions
-		       (org-export-get-parent-table table-row info) info))))
+		       (org-export-get-parent-table table-row) info))))
 	;; When BOOKTABS are activated enforce bottom rule even when
 	;; When BOOKTABS are activated enforce bottom rule even when
 	;; no hline was specifically marked.
 	;; no hline was specifically marked.
 	((and booktabsp (memq 'bottom borders)) "\\bottomrule")
 	((and booktabsp (memq 'bottom borders)) "\\bottomrule")

+ 17 - 17
contrib/lisp/org-e-odt.el

@@ -534,7 +534,7 @@ Update styles.xml with styles that were collected as part of
 	       (t (error "what is this?"))))
 	       (t (error "what is this?"))))
 	 (caption-from
 	 (caption-from
 	  (case (org-element-type element)
 	  (case (org-element-type element)
-	    (link (org-export-get-parent-paragraph element info))
+	    (link (org-export-get-parent-element element))
 	    (t element)))
 	    (t element)))
 	 (captions (org-e-odt-format-label caption-from info 'definition))
 	 (captions (org-e-odt-format-label caption-from info 'definition))
 	 (caption (car captions))
 	 (caption (car captions))
@@ -858,7 +858,7 @@ ATTR is a string of other attributes of the a element."
 (defun org-e-odt-format-label (element info op)
 (defun org-e-odt-format-label (element info op)
   (let* ((caption-from
   (let* ((caption-from
 	  (case (org-element-type element)
 	  (case (org-element-type element)
-	    (link (org-export-get-parent-paragraph element info))
+	    (link (org-export-get-parent-element element))
 	    (t element)))
 	    (t element)))
 	 ;; get label and caption.
 	 ;; get label and caption.
 	 (label (org-element-property :name caption-from))
 	 (label (org-element-property :name caption-from))
@@ -2802,7 +2802,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 CONTENTS is nil.  INFO is a plist holding contextual information."
 CONTENTS is nil.  INFO is a plist holding contextual information."
   (concat
   (concat
    ;; Insert separator between two footnotes in a row.
    ;; Insert separator between two footnotes in a row.
-   (let ((prev (org-export-get-previous-element footnote-reference info)))
+   (let ((prev (org-export-get-previous-element footnote-reference)))
      (when (eq (org-element-type prev) 'footnote-reference)
      (when (eq (org-element-type prev) 'footnote-reference)
        org-e-odt-footnote-separator))
        org-e-odt-footnote-separator))
    (cond
    (cond
@@ -2989,7 +2989,7 @@ contextual information."
   "Transcode an ITEM element from Org to ODT.
   "Transcode an ITEM element from Org to ODT.
 CONTENTS holds the contents of the item.  INFO is a plist holding
 CONTENTS holds the contents of the item.  INFO is a plist holding
 contextual information."
 contextual information."
-  (let* ((plain-list (org-export-get-parent item info))
+  (let* ((plain-list (org-export-get-parent item))
 	 (type (org-element-property :type plain-list))
 	 (type (org-element-property :type plain-list))
 	 (counter (org-element-property :counter item))
 	 (counter (org-element-property :counter item))
 	 (tag (let ((tag (org-element-property :tag item)))
 	 (tag (let ((tag (org-element-property :tag item)))
@@ -3158,7 +3158,7 @@ used as a communication channel."
 		(org-e-odt-copy-image-file src)))
 		(org-e-odt-copy-image-file src)))
 	 ;; extract attributes from #+ATTR_ODT line.
 	 ;; extract attributes from #+ATTR_ODT line.
 	 (attr-from (case (org-element-type element)
 	 (attr-from (case (org-element-type element)
-		      (link (org-export-get-parent-paragraph element info))
+		      (link (org-export-get-parent-element element))
 		      (t element)))
 		      (t element)))
 	 ;; convert attributes to a plist.
 	 ;; convert attributes to a plist.
 	 (attr-plist (org-e-odt-element-attributes attr-from info))
 	 (attr-plist (org-e-odt-element-attributes attr-from info))
@@ -3257,7 +3257,7 @@ standalone images, do the following.
 		     (paragraph element)
 		     (paragraph element)
 		     (link (and (org-export-inline-image-p
 		     (link (and (org-export-inline-image-p
 				 element org-e-odt-inline-image-rules)
 				 element org-e-odt-inline-image-rules)
-				(org-export-get-parent element info)))
+				(org-export-get-parent element)))
 		     (t nil))))
 		     (t nil))))
     (when paragraph
     (when paragraph
       (assert (eq (org-element-type paragraph) 'paragraph))
       (assert (eq (org-element-type paragraph) 'paragraph))
@@ -3403,7 +3403,7 @@ the plist used as a communication channel."
 	 (class (cdr (assoc style '((footnote . "footnote")
 	 (class (cdr (assoc style '((footnote . "footnote")
 				    (verse . nil)))))
 				    (verse . nil)))))
 	 (extra (if class (format " class=\"%s\"" class) ""))
 	 (extra (if class (format " class=\"%s\"" class) ""))
-	 (parent (org-export-get-parent paragraph info))
+	 (parent (org-export-get-parent paragraph))
 	 (parent-type (org-element-type parent))
 	 (parent-type (org-element-type parent))
 	 (style (case parent-type
 	 (style (case parent-type
 		  (quote-block 'quote)
 		  (quote-block 'quote)
@@ -3443,7 +3443,7 @@ contextual information."
 	     ;; If top-level list, re-start numbering.  Otherwise,
 	     ;; If top-level list, re-start numbering.  Otherwise,
 	     ;; continue numbering.
 	     ;; continue numbering.
 	     (format "text:continue-numbering=\"%s\""
 	     (format "text:continue-numbering=\"%s\""
-		     (let* ((parent (org-export-get-parent plain-list info)))
+		     (let* ((parent (org-export-get-parent plain-list)))
 		       (if (and parent (equal (org-element-type parent) 'item))
 		       (if (and parent (equal (org-element-type parent) 'item))
 			   "true" "false")))
 			   "true" "false")))
 	     contents))))
 	     contents))))
@@ -3624,7 +3624,7 @@ contextual information."
 ;;;; Table Cell
 ;;;; Table Cell
 
 
 (defun org-e-odt-table-style-spec (element info)
 (defun org-e-odt-table-style-spec (element info)
-  (let* ((table (org-export-get-parent-table element info))
+  (let* ((table (org-export-get-parent-table element))
 	 (table-attributes (org-e-odt-element-attributes table info))
 	 (table-attributes (org-e-odt-element-attributes table info))
 	 (table-style (plist-get table-attributes :style)))
 	 (table-style (plist-get table-attributes :style)))
     (assoc table-style org-e-odt-table-styles)))
     (assoc table-style org-e-odt-table-styles)))
@@ -3650,7 +3650,7 @@ styles congruent with the ODF-1.2 specification."
 	 (r (car table-cell-address)) (c (cdr table-cell-address))
 	 (r (car table-cell-address)) (c (cdr table-cell-address))
 	 (style-spec (org-e-odt-table-style-spec table-cell info))
 	 (style-spec (org-e-odt-table-style-spec table-cell info))
 	 (table-dimensions (org-export-table-dimensions
 	 (table-dimensions (org-export-table-dimensions
-			    (org-export-get-parent-table table-cell info)
+			    (org-export-get-parent-table table-cell)
 			    info)))
 			    info)))
     (when style-spec
     (when style-spec
       ;; LibreOffice - particularly the Writer - honors neither table
       ;; LibreOffice - particularly the Writer - honors neither table
@@ -3697,7 +3697,7 @@ channel."
 	 (r (car table-cell-address))
 	 (r (car table-cell-address))
 	 (c (cdr table-cell-address))
 	 (c (cdr table-cell-address))
 	 (horiz-span (or (org-export-table-cell-width table-cell info) 0))
 	 (horiz-span (or (org-export-table-cell-width table-cell info) 0))
-	 (table-row (org-export-get-parent table-cell info))
+	 (table-row (org-export-get-parent table-cell))
 	 (custom-style-prefix (org-e-odt-get-table-cell-styles
 	 (custom-style-prefix (org-e-odt-get-table-cell-styles
 			       table-cell info))
 			       table-cell info))
 	 (paragraph-style
 	 (paragraph-style
@@ -3708,9 +3708,9 @@ channel."
 	    (cond
 	    (cond
 	     ((and (= 1 (org-export-table-row-group table-row info))
 	     ((and (= 1 (org-export-table-row-group table-row info))
 		   (org-export-table-has-header-p
 		   (org-export-table-has-header-p
-		    (org-export-get-parent-table table-row info) info))
+		    (org-export-get-parent-table table-row) info))
 	      "OrgTableHeading")
 	      "OrgTableHeading")
-	     ((let* ((table (org-export-get-parent-table table-cell info))
+	     ((let* ((table (org-export-get-parent-table table-cell))
 		     (table-attrs (org-e-odt-element-attributes table info))
 		     (table-attrs (org-e-odt-element-attributes table info))
 		     (table-header-columns (plist-get table-attrs
 		     (table-header-columns (plist-get table-attrs
 						      :header-columns)))
 						      :header-columns)))
@@ -3763,7 +3763,7 @@ communication channel."
     (let* ((rowgroup-tags
     (let* ((rowgroup-tags
 	    (if (and (= 1 (org-export-table-row-group table-row info))
 	    (if (and (= 1 (org-export-table-row-group table-row info))
 		     (org-export-table-has-header-p
 		     (org-export-table-has-header-p
-		      (org-export-get-parent-table table-row info) info))
+		      (org-export-get-parent-table table-row) info))
 		;; If the row belongs to the first rowgroup and the
 		;; If the row belongs to the first rowgroup and the
 		;; table has more than one row groups, then this row
 		;; table has more than one row groups, then this row
 		;; belongs to the header row group.
 		;; belongs to the header row group.
@@ -3854,7 +3854,7 @@ contextual information."
   (let* ((--get-previous-elements
   (let* ((--get-previous-elements
 	  (function
 	  (function
 	   (lambda (blob info)
 	   (lambda (blob info)
-	     (let ((parent (org-export-get-parent blob info)))
+	     (let ((parent (org-export-get-parent blob)))
 	       (cdr (member blob (reverse (org-element-contents parent))))))))
 	       (cdr (member blob (reverse (org-element-contents parent))))))))
 	 (--element-preceded-by-table-p
 	 (--element-preceded-by-table-p
 	  (function
 	  (function
@@ -3864,7 +3864,7 @@ contextual information."
 	 (--walk-list-genealogy-and-collect-tags
 	 (--walk-list-genealogy-and-collect-tags
 	  (function
 	  (function
 	   (lambda (table info)
 	   (lambda (table info)
-	     (let* ((genealogy (org-export-get-genealogy table info))
+	     (let* ((genealogy (org-export-get-genealogy table))
 		    (list-genealogy
 		    (list-genealogy
 		     (when (equal (org-element-type (car genealogy)) 'item)
 		     (when (equal (org-element-type (car genealogy)) 'item)
 		       (loop for el in genealogy
 		       (loop for el in genealogy
@@ -4181,7 +4181,7 @@ using `org-open-file'."
   (let* ((numbered-parent-headline-at-<=-n
   (let* ((numbered-parent-headline-at-<=-n
 	  (function
 	  (function
 	   (lambda (element n info)
 	   (lambda (element n info)
-	     (loop for x in (org-export-get-genealogy element info)
+	     (loop for x in (org-export-get-genealogy element)
 		   thereis (and (eq (org-element-type x) 'headline)
 		   thereis (and (eq (org-element-type x) 'headline)
 		   		(<= (org-export-get-relative-level x info) n)
 		   		(<= (org-export-get-relative-level x info) n)
 		   		(org-export-numbered-headline-p x info)
 		   		(org-export-numbered-headline-p x info)

+ 2 - 2
contrib/lisp/org-e-publish.el

@@ -50,7 +50,7 @@
 (declare-function
 (declare-function
  org-export-to-file "org-export"
  org-export-to-file "org-export"
  (backend file &optional subtreep visible-only body-only ext-plist))
  (backend file &optional subtreep visible-only body-only ext-plist))
-(declare-function org-export-get-parent-headline "org-export" (blob info))
+(declare-function org-export-get-parent-headline "org-export" (blob))
 (declare-function org-export-get-environment "org-export"
 (declare-function org-export-get-environment "org-export"
 		  (&optional backend subtreep ext-plist))
 		  (&optional backend subtreep ext-plist))
 (declare-function org-export-get-inbuffer-options "org-export"
 (declare-function org-export-get-inbuffer-options "org-export"
@@ -979,7 +979,7 @@ keyword."
        (when (string= (downcase (org-element-property :key k))
        (when (string= (downcase (org-element-property :key k))
 		      "index")
 		      "index")
 	 (let ((index (org-element-property :value k))
 	 (let ((index (org-element-property :value k))
-	       (parent (org-export-get-parent-headline k info)))
+	       (parent (org-export-get-parent-headline k)))
 	   (list index (plist-get info :input-file) parent))))
 	   (list index (plist-get info :input-file) parent))))
      info)))
      info)))
   ;; Return parse-tree to avoid altering output.
   ;; Return parse-tree to avoid altering output.

+ 68 - 109
contrib/lisp/org-export.el

@@ -1601,8 +1601,8 @@ tag."
     ;; Check table-cell.
     ;; Check table-cell.
     (table-cell
     (table-cell
      (and (org-export-table-has-special-column-p
      (and (org-export-table-has-special-column-p
-	   (nth 1 (org-export-get-genealogy blob options)))
-	  (not (org-export-get-previous-element blob options))))
+	   (org-export-get-parent-table blob))
+	  (not (org-export-get-previous-element blob))))
     ;; Check clock.
     ;; Check clock.
     (clock (not (plist-get options :with-clocks)))
     (clock (not (plist-get options :with-clocks)))
     ;; Check planning.
     ;; Check planning.
@@ -1702,7 +1702,7 @@ Return transcoded string."
 			     ;; indentation: there is none and it
 			     ;; indentation: there is none and it
 			     ;; might be misleading.
 			     ;; might be misleading.
 			     (when (eq type 'paragraph)
 			     (when (eq type 'paragraph)
-			       (let ((parent (org-export-get-parent data info)))
+			       (let ((parent (org-export-get-parent data)))
 				 (and (equal (car (org-element-contents parent))
 				 (and (equal (car (org-element-contents parent))
 					     data)
 					     data)
 				      (memq (org-element-type parent)
 				      (memq (org-element-type parent)
@@ -2837,13 +2837,13 @@ Any tag belonging to this list will also be removed."
 (defun org-export-first-sibling-p (headline info)
 (defun org-export-first-sibling-p (headline info)
   "Non-nil when HEADLINE is the first sibling in its sub-tree.
   "Non-nil when HEADLINE is the first sibling in its sub-tree.
 INFO is the plist used as a communication channel."
 INFO is the plist used as a communication channel."
-  (not (eq (org-element-type (org-export-get-previous-element headline info))
+  (not (eq (org-element-type (org-export-get-previous-element headline))
 	   'headline)))
 	   'headline)))
 
 
 (defun org-export-last-sibling-p (headline info)
 (defun org-export-last-sibling-p (headline info)
   "Non-nil when HEADLINE is the last sibling in its sub-tree.
   "Non-nil when HEADLINE is the last sibling in its sub-tree.
 INFO is the plist used as a communication channel."
 INFO is the plist used as a communication channel."
-  (not (org-export-get-next-element headline info)))
+  (not (org-export-get-next-element headline)))
 
 
 
 
 ;;;; For Links
 ;;;; For Links
@@ -3004,7 +3004,7 @@ Assume LINK type is \"fuzzy\"."
 		 (when (eq (org-element-type parent) 'headline)
 		 (when (eq (org-element-type parent) 'headline)
 		   (let ((foundp (funcall find-headline path parent)))
 		   (let ((foundp (funcall find-headline path parent)))
 		     (when foundp (throw 'exit foundp)))))
 		     (when foundp (throw 'exit foundp)))))
-	       (org-export-get-genealogy link info)) nil)
+	       (org-export-get-genealogy link)) nil)
 	    ;; No match with a common ancestor: try the full parse-tree.
 	    ;; No match with a common ancestor: try the full parse-tree.
 	    (funcall find-headline
 	    (funcall find-headline
 		     (if match-title-p (substring path 1) path)
 		     (if match-title-p (substring path 1) path)
@@ -3109,7 +3109,7 @@ objects of the same type."
     ;; table, item, or headline containing the object.
     ;; table, item, or headline containing the object.
     (when (eq (org-element-type element) 'target)
     (when (eq (org-element-type element) 'target)
       (setq element
       (setq element
-	    (loop for parent in (org-export-get-genealogy element info)
+	    (loop for parent in (org-export-get-genealogy element)
 		  when
 		  when
 		  (memq
 		  (memq
 		   (org-element-type parent)
 		   (org-element-type parent)
@@ -3402,7 +3402,7 @@ All special rows will be ignored during export."
        ;; ... the table contains a special column and the row start
        ;; ... the table contains a special column and the row start
        ;; with a marking character among, "^", "_", "$" or "!",
        ;; with a marking character among, "^", "_", "$" or "!",
        (and (org-export-table-has-special-column-p
        (and (org-export-table-has-special-column-p
-	     (org-export-get-parent table-row info))
+	     (org-export-get-parent table-row))
 	    (member first-cell '(("^") ("_") ("$") ("!"))))
 	    (member first-cell '(("^") ("_") ("$") ("!"))))
        ;; ... it contains only alignment cookies and empty cells.
        ;; ... it contains only alignment cookies and empty cells.
        (let ((special-row-p 'empty))
        (let ((special-row-p 'empty))
@@ -3442,7 +3442,7 @@ rows and table rules.  Group 1 is also table's header."
 	    ((eq (org-element-property :type row) 'rule)
 	    ((eq (org-element-property :type row) 'rule)
 	     (setq row-flag nil)))
 	     (setq row-flag nil)))
 	   (when (equal table-row row) (throw 'found group)))
 	   (when (equal table-row row) (throw 'found group)))
-	 (org-element-contents (org-export-get-parent table-row info)))))))
+	 (org-element-contents (org-export-get-parent table-row)))))))
 
 
 (defun org-export-table-cell-width (table-cell info)
 (defun org-export-table-cell-width (table-cell info)
   "Return TABLE-CELL contents width.
   "Return TABLE-CELL contents width.
@@ -3451,11 +3451,10 @@ INFO is a plist used as the communication channel.
 
 
 Return value is the width given by the last width cookie in the
 Return value is the width given by the last width cookie in the
 same column as TABLE-CELL, or nil."
 same column as TABLE-CELL, or nil."
-  (let* ((genealogy (org-export-get-genealogy table-cell info))
-	 (row (car genealogy))
+  (let* ((row (org-export-get-parent table-cell))
 	 (column (let ((cells (org-element-contents row)))
 	 (column (let ((cells (org-element-contents row)))
 		   (- (length cells) (length (member table-cell cells)))))
 		   (- (length cells) (length (member table-cell cells)))))
-	 (table (nth 1 genealogy))
+	 (table (org-export-get-parent-table table-cell))
 	 cookie-width)
 	 cookie-width)
     (mapc
     (mapc
      (lambda (row)
      (lambda (row)
@@ -3489,11 +3488,10 @@ same column as TABLE-CELL.  If no such cookie is found, a default
 alignment value will be deduced from fraction of numbers in the
 alignment value will be deduced from fraction of numbers in the
 column (see `org-table-number-fraction' for more information).
 column (see `org-table-number-fraction' for more information).
 Possible values are `left', `right' and `center'."
 Possible values are `left', `right' and `center'."
-  (let* ((genealogy (org-export-get-genealogy table-cell info))
-	 (row (car genealogy))
+  (let* ((row (org-export-get-parent table-cell))
 	 (column (let ((cells (org-element-contents row)))
 	 (column (let ((cells (org-element-contents row)))
 		   (- (length cells) (length (member table-cell cells)))))
 		   (- (length cells) (length (member table-cell cells)))))
-	 (table (nth 1 genealogy))
+	 (table (org-export-get-parent-table table-cell))
 	 (number-cells 0)
 	 (number-cells 0)
 	 (total-cells 0)
 	 (total-cells 0)
 	 cookie-align)
 	 cookie-align)
@@ -3549,9 +3547,8 @@ Return value is a list of symbols, or nil.  Possible values are:
 row (resp. last row) of the table, ignoring table rules, if any.
 row (resp. last row) of the table, ignoring table rules, if any.
 
 
 Returned borders ignore special rows."
 Returned borders ignore special rows."
-  (let* ((genealogy (org-export-get-genealogy table-cell info))
-	 (row (car genealogy))
-	 (table (nth 1 genealogy))
+  (let* ((row (org-export-get-parent table-cell))
+	 (table (org-export-get-parent-table table-cell))
 	 borders)
 	 borders)
     ;; Top/above border?  TABLE-CELL has a border above when a rule
     ;; Top/above border?  TABLE-CELL has a border above when a rule
     ;; used to demarcate row groups can be found above.  Hence,
     ;; used to demarcate row groups can be found above.  Hence,
@@ -3635,7 +3632,7 @@ INFO is a plist used as a communication channel."
   ;; of a row (or after the special column, if any) or when it has
   ;; of a row (or after the special column, if any) or when it has
   ;; a left border.
   ;; a left border.
   (or (equal (org-element-map
   (or (equal (org-element-map
-	      (org-export-get-parent table-cell info)
+	      (org-export-get-parent table-cell)
 	      'table-cell 'identity info 'first-match)
 	      'table-cell 'identity info 'first-match)
 	     table-cell)
 	     table-cell)
       (memq 'left (org-export-table-cell-borders table-cell info))))
       (memq 'left (org-export-table-cell-borders table-cell info))))
@@ -3646,7 +3643,7 @@ INFO is a plist used as a communication channel."
   ;; A cell ends a column group either when it is at the end of a row
   ;; A cell ends a column group either when it is at the end of a row
   ;; or when it has a right border.
   ;; or when it has a right border.
   (or (equal (car (last (org-element-contents
   (or (equal (car (last (org-element-contents
-			 (org-export-get-parent table-cell info))))
+			 (org-export-get-parent table-cell))))
 	     table-cell)
 	     table-cell)
       (memq 'right (org-export-table-cell-borders table-cell info))))
       (memq 'right (org-export-table-cell-borders table-cell info))))
 
 
@@ -3672,7 +3669,7 @@ INFO is a plist used as a communication channel."
   "Non-nil when TABLE-ROW is the first table header's row.
   "Non-nil when TABLE-ROW is the first table header's row.
 INFO is a plist used as a communication channel."
 INFO is a plist used as a communication channel."
   (and (org-export-table-has-header-p
   (and (org-export-table-has-header-p
-	(org-export-get-parent-table table-row info) info)
+	(org-export-get-parent-table table-row) info)
        (org-export-table-row-starts-rowgroup-p table-row info)
        (org-export-table-row-starts-rowgroup-p table-row info)
        (= (org-export-table-row-group table-row info) 1)))
        (= (org-export-table-row-group table-row info) 1)))
 
 
@@ -3680,7 +3677,7 @@ INFO is a plist used as a communication channel."
   "Non-nil when TABLE-ROW is the last table header's row.
   "Non-nil when TABLE-ROW is the last table header's row.
 INFO is a plist used as a communication channel."
 INFO is a plist used as a communication channel."
   (and (org-export-table-has-header-p
   (and (org-export-table-has-header-p
-	(org-export-get-parent-table table-row info) info)
+	(org-export-get-parent-table table-row) info)
        (org-export-table-row-ends-rowgroup-p table-row info)
        (org-export-table-row-ends-rowgroup-p table-row info)
        (= (org-export-table-row-group table-row info) 1)))
        (= (org-export-table-row-group table-row info) 1)))
 
 
@@ -3714,8 +3711,8 @@ a communication channel.
 Address is a CONS cell (ROW . COLUMN), where ROW and COLUMN are
 Address is a CONS cell (ROW . COLUMN), where ROW and COLUMN are
 zero-based index.  Only exportable cells are considered.  The
 zero-based index.  Only exportable cells are considered.  The
 function returns nil for other cells."
 function returns nil for other cells."
-  (let* ((table-row (org-export-get-parent table-cell info))
-	 (table (org-export-get-parent-table table-cell info)))
+  (let* ((table-row (org-export-get-parent table-cell))
+	 (table (org-export-get-parent-table table-cell)))
     ;; Ignore cells in special rows or in special column.
     ;; Ignore cells in special rows or in special column.
     (unless (or (org-export-table-row-is-special-p table-row info)
     (unless (or (org-export-table-row-is-special-p table-row info)
 		(and (org-export-table-has-special-column-p table)
 		(and (org-export-table-has-special-column-p table)
@@ -3852,102 +3849,64 @@ Return a list of src-block elements with a caption."
 ;; Here are various functions to retrieve information about the
 ;; Here are various functions to retrieve information about the
 ;; neighbourhood of a given element or object.  Neighbours of interest
 ;; neighbourhood of a given element or object.  Neighbours of interest
 ;; are direct parent (`org-export-get-parent'), parent headline
 ;; are direct parent (`org-export-get-parent'), parent headline
-;; (`org-export-get-parent-headline'), parent paragraph
-;; (`org-export-get-parent-paragraph'), previous element or object
+;; (`org-export-get-parent-headline'), first element containing an
+;; object, (`org-export-get-parent-element'), parent table
+;; (`org-export-get-parent-table'), previous element or object
 ;; (`org-export-get-previous-element') and next element or object
 ;; (`org-export-get-previous-element') and next element or object
 ;; (`org-export-get-next-element').
 ;; (`org-export-get-next-element').
 ;;
 ;;
-;; All of these functions are just a specific use of the more generic
-;; `org-export-get-genealogy', which returns the genealogy relative to
-;; the element or object.
-
-(defun org-export-get-genealogy (blob info)
-  "Return genealogy relative to a given element or object.
-BLOB is the element or object being considered.  INFO is a plist
-used as a communication channel."
-  (let* ((type (org-element-type blob))
-	 (end (org-element-property :end blob))
-	 walk-data			; for byte-compiler.
-         (walk-data
-          (lambda (data genealogy)
-	    ;; Walk DATA, looking for BLOB.  GENEALOGY is the list of
-	    ;; parents of all elements in DATA.
-            (mapc
-             (lambda (el)
-               (cond
-		((stringp el) nil)
-                ((equal el blob) (throw 'exit genealogy))
-                ((>= (org-element-property :end el) end)
-		 ;; If BLOB is an object and EL contains a secondary
-		 ;; string, be sure to check it.
-		 (when (memq type org-element-all-objects)
-		   (let ((sec-prop
-			  (cdr (assq (org-element-type el)
-				     org-element-secondary-value-alist))))
-		     (when sec-prop
-		       (funcall
-			walk-data
-			(cons 'org-data
-			      (cons nil (org-element-property sec-prop el)))
-			(cons el genealogy)))))
-                 (funcall walk-data el (cons el genealogy)))))
-	     (org-element-contents data)))))
-    (catch 'exit (funcall walk-data (plist-get info :parse-tree) nil) nil)))
-
-(defun org-export-get-parent (blob info)
-  "Return BLOB parent or nil.
-BLOB is the element or object considered.  INFO is a plist used
-as a communication channel."
-  (car (org-export-get-genealogy blob info)))
+;; `org-export-get-genealogy' returns the full genealogy of a given
+;; element or object, from closest parent to full parse tree.
 
 
-(defun org-export-get-parent-headline (blob info)
+(defun org-export-get-parent (blob)
+  "Return BLOB parent or nil.
+BLOB is the element or object considered."
+  (org-element-property :parent blob))
+
+(defun org-export-get-genealogy (blob)
+  "Return full genealogy relative to a given element or object.
+BLOB is the element or object being considered."
+  (let (genealogy (parent blob))
+    (while (setq parent (org-element-property :parent parent))
+      (push parent genealogy))
+    (nreverse genealogy)))
+
+(defun org-export-get-parent-headline (blob)
   "Return BLOB parent headline or nil.
   "Return BLOB parent headline or nil.
-BLOB is the element or object being considered.  INFO is a plist
-used as a communication channel."
-  (catch 'exit
-    (mapc
-     (lambda (el) (when (eq (org-element-type el) 'headline) (throw 'exit el)))
-     (org-export-get-genealogy blob info))
-    nil))
-
-(defun org-export-get-parent-paragraph (object info)
-  "Return OBJECT parent paragraph or nil.
-OBJECT is the object to consider.  INFO is a plist used as
-a communication channel."
-  (catch 'exit
-    (mapc
-     (lambda (el) (when (eq (org-element-type el) 'paragraph) (throw 'exit el)))
-     (org-export-get-genealogy object info))
-    nil))
-
-(defun org-export-get-parent-table (object info)
+BLOB is the element or object being considered."
+  (let ((parent blob))
+    (while (and (setq parent (org-element-property :parent parent))
+		(not (eq (org-element-type parent) 'headline))))
+    parent))
+
+(defun org-export-get-parent-element (object)
+  "Return first element containing OBJECT or nil.
+OBJECT is the object to consider."
+  (let ((parent object))
+    (while (and (setq parent (org-element-property :parent parent))
+		(memq (org-element-type parent) org-element-all-objects)))
+    parent))
+
+(defun org-export-get-parent-table (object)
   "Return OBJECT parent table or nil.
   "Return OBJECT parent table or nil.
-OBJECT is either a `table-cell' or `table-element' type object.
-INFO is a plist used as a communication channel."
-  (catch 'exit
-    (mapc
-     (lambda (el) (when (eq (org-element-type el) 'table) (throw 'exit el)))
-     (org-export-get-genealogy object info))
-    nil))
+OBJECT is either a `table-cell' or `table-element' type object."
+  (let ((parent object))
+    (while (and (setq parent (org-element-property :parent parent))
+		(not (eq (org-element-type parent) 'table))))
+    parent))
 
 
-(defun org-export-get-previous-element (blob info)
+(defun org-export-get-previous-element (blob)
   "Return previous element or object.
   "Return previous element or object.
-
-BLOB is an element or object.  INFO is a plist used as
-a communication channel.
-
-Return previous element or object, a string, or nil."
-  (let ((parent (org-export-get-parent blob info)))
+BLOB is an element or object.  Return previous element or object,
+a string, or nil."
+  (let ((parent (org-export-get-parent blob)))
     (cadr (member blob (reverse (org-element-contents parent))))))
     (cadr (member blob (reverse (org-element-contents parent))))))
 
 
-(defun org-export-get-next-element (blob info)
+(defun org-export-get-next-element (blob)
   "Return next element or object.
   "Return next element or object.
-
-BLOB is an element or object.  INFO is a plist used as
-a communication channel.
-
-Return next element or object, a string, or nil."
-  (let ((parent (org-export-get-parent blob info)))
+BLOB is an element or object.  Return next element or object,
+a string, or nil."
+  (let ((parent (org-export-get-parent blob)))
     (cadr (member blob (org-element-contents parent)))))
     (cadr (member blob (org-element-contents parent)))))