Function: org-export-get-previous-element

org-export-get-previous-element is a byte-compiled function defined in ox.el.gz.

Signature

(org-export-get-previous-element BLOB INFO &optional N)

Documentation

Return previous element or object.

BLOB is an element or object. INFO is a plist used as a communication channel. Return previous exportable element or object, a string, or nil.

When optional argument N is a positive integer, return a list containing up to N siblings before BLOB, from farthest to closest. With any other non-nil value, return a list containing all of them.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
(defun org-export-get-previous-element (blob info &optional n)
  "Return previous element or object.

BLOB is an element or object.  INFO is a plist used as
a communication channel.  Return previous exportable element or
object, a string, or nil.

When optional argument N is a positive integer, return a list
containing up to N siblings before BLOB, from farthest to
closest.  With any other non-nil value, return a list containing
all of them."
  (let* ((secondary (org-element-secondary-p blob))
	 (parent (org-export-get-parent blob))
	 (siblings
	  (if secondary (org-element-property secondary parent)
	    (org-element-contents parent)))
	 prev)
    (catch 'exit
      (dolist (obj (cdr (memq blob (reverse siblings))) prev)
	(cond ((memq obj (plist-get info :ignore-list)))
	      ((null n) (throw 'exit obj))
	      ((not (wholenump n)) (push obj prev))
	      ((zerop n) (throw 'exit prev))
	      (t (cl-decf n) (push obj prev)))))))