diff --git a/EXPERIMENTAL/org-e-ascii.el b/EXPERIMENTAL/org-e-ascii.el index 1522b1e83..aa4be5fdc 100644 --- a/EXPERIMENTAL/org-e-ascii.el +++ b/EXPERIMENTAL/org-e-ascii.el @@ -1279,34 +1279,32 @@ contextual information." ;; First parent of ITEM is always the plain-list. Get ;; `:type' property from it. (org-list-bullet-string - (let ((type (org-element-property - :type (car (org-export-get-genealogy item info))))) - (cond - ((eq type 'descriptive) - (concat - (org-export-secondary-string - (org-element-property :tag item) 'e-ascii info) ": ")) - ((eq type 'ordered) - ;; Return correct number for ITEM, paying attention to - ;; counters. - (let* ((struct (org-element-property :structure item)) - (bul (org-element-property :bullet item)) - (num - (number-to-string - (car (last (org-list-get-item-number - (org-element-property :begin item) - struct - (org-list-prevs-alist struct) - (org-list-parents-alist struct))))))) - (replace-regexp-in-string "[0-9]+" num bul))) - (t (let ((bul (org-element-property :bullet item))) - ;; Change bullets into more visible form if UTF-8 is active. - (if (not (eq (plist-get info :ascii-charset) 'utf-8)) bul + (case (org-element-property :type (org-export-get-parent item info)) + (descriptive + (concat + (org-export-secondary-string + (org-element-property :tag item) 'e-ascii info) ": ")) + (ordered + ;; Return correct number for ITEM, paying attention to + ;; counters. + (let* ((struct (org-element-property :structure item)) + (bul (org-element-property :bullet item)) + (num + (number-to-string + (car (last (org-list-get-item-number + (org-element-property :begin item) + struct + (org-list-prevs-alist struct) + (org-list-parents-alist struct))))))) + (replace-regexp-in-string "[0-9]+" num bul))) + (t (let ((bul (org-element-property :bullet item))) + ;; Change bullets into more visible form if UTF-8 is active. + (if (not (eq (plist-get info :ascii-charset) 'utf-8)) bul + (replace-regexp-in-string + "-" "•" (replace-regexp-in-string - "-" "•" - (replace-regexp-in-string - "+" "⁃" - (replace-regexp-in-string "*" "‣" bul))))))))))) + "+" "⁃" + (replace-regexp-in-string "*" "‣" bul)))))))))) (concat bullet ;; Contents: Pay attention to indentation. Note: check-boxes are @@ -1432,7 +1430,7 @@ information." CONTENTS is the contents of the paragraph, as a string. INFO is the plist used as a communication channel." (org-e-ascii--fill-string - (let ((parent (car (org-export-get-genealogy paragraph info)))) + (let ((parent (org-export-get-parent paragraph info))) ;; 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, ;; it would interfere with line width. diff --git a/EXPERIMENTAL/org-e-html.el b/EXPERIMENTAL/org-e-html.el index 738d84b50..2cfb8280e 100644 --- a/EXPERIMENTAL/org-e-html.el +++ b/EXPERIMENTAL/org-e-html.el @@ -2506,10 +2506,9 @@ CONTENTS holds the contents of the item. INFO is a plist holding contextual information." ;; Grab `:level' from plain-list properties, which is always the ;; first element above current item. - (let* ((plain-list (car (org-export-get-genealogy item info))) + (let* ((plain-list (org-export-get-parent item info)) (type (org-element-property :type plain-list)) - (level (org-element-property - :level (car (plist-get info :genealogy)))) + (level (org-element-property :level plain-list)) (counter (org-element-property :counter item)) (checkbox (org-element-property :checkbox item)) (tag (let ((tag (org-element-property :tag item))) diff --git a/EXPERIMENTAL/org-e-latex.el b/EXPERIMENTAL/org-e-latex.el index 452659ef8..35561cfb5 100644 --- a/EXPERIMENTAL/org-e-latex.el +++ b/EXPERIMENTAL/org-e-latex.el @@ -1233,8 +1233,7 @@ CONTENTS holds the contents of the item. INFO is a plist holding contextual information." ;; Grab `:level' from plain-list properties, which is always the ;; first element above current item. - (let* ((level (org-element-property - :level (car (org-export-get-genealogy item info)))) + (let* ((level (org-element-property :level (org-export-get-parent item info))) (counter (let ((count (org-element-property :counter item))) (and count (< level 4) diff --git a/EXPERIMENTAL/org-e-odt.el b/EXPERIMENTAL/org-e-odt.el index a1d53436f..3437a5e8c 100644 --- a/EXPERIMENTAL/org-e-odt.el +++ b/EXPERIMENTAL/org-e-odt.el @@ -4225,10 +4225,9 @@ CONTENTS holds the contents of the item. INFO is a plist holding contextual information." ;; Grab `:level' from plain-list properties, which is always the ;; first element above current item. - (let* ((plain-list (car (org-export-get-genealogy item info))) + (let* ((plain-list (org-export-get-parent item info)) (type (org-element-property :type plain-list)) - (level (org-element-property - :level (car (plist-get info :genealogy)))) + (level (org-element-property :level plain-list)) (counter (org-element-property :counter item)) (checkbox (org-element-property :checkbox item)) (tag (let ((tag (org-element-property :tag item))) diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index 0901a4b1d..67f25f9af 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -1519,9 +1519,7 @@ Return transcoded string." ;; indentation: there is none and it might be ;; misleading. (and (not (org-export-get-previous-element blob info)) - (let ((parent - (car - (org-export-get-genealogy blob info)))) + (let ((parent (org-export-get-parent blob info))) (memq (org-element-type parent) '(footnote-definition item))))))) (org-export-data paragraph backend info))))) @@ -3138,10 +3136,11 @@ affiliated keyword." ;; Here are various functions to retrieve information about the ;; neighbourhood of a given element or object. Neighbours of interest -;; are parent headline (`org-export-get-parent-headline'), parent -;; paragraph (`org-export-get-parent-paragraph'), previous element or -;; object (`org-export-get-previous-element') and next element or -;; object (`org-export-get-next-element'). +;; 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-previous-element') and next element or object +;; (`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 @@ -3164,6 +3163,12 @@ used as a communication channel." (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))) + (defun org-export-get-parent-headline (blob info) "Return closest parent headline or nil. @@ -3198,7 +3203,7 @@ 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 (car (org-export-get-genealogy blob info)))) + (let ((parent (org-export-get-parent blob info))) (cadr (member blob (reverse (org-element-contents parent)))))) (defun org-export-get-next-element (blob info) @@ -3208,7 +3213,7 @@ 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 (car (org-export-get-genealogy blob info)))) + (let ((parent (org-export-get-parent blob info))) (cadr (member blob (org-element-contents parent)))))