Function: org-list-to-subtree

org-list-to-subtree is a byte-compiled function defined in org-list.el.gz.

Signature

(org-list-to-subtree LIST &optional START-LEVEL PARAMS)

Documentation

Convert LIST into an Org subtree.

LIST is as returned by org-list-to-lisp. Subtree starts at START-LEVEL or level 1 if nil. PARAMS is a property list with overruling parameters for org-list-to-generic.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-list.el.gz
(defun org-list-to-subtree (list &optional start-level params)
  "Convert LIST into an Org subtree.
LIST is as returned by `org-list-to-lisp'.  Subtree starts at
START-LEVEL or level 1 if nil.  PARAMS is a property list with
overruling parameters for `org-list-to-generic'."
  (let* ((blank (pcase (cdr (assq 'heading org-blank-before-new-entry))
		  (`t t)
		  (`auto (save-excursion
			   (org-with-limited-levels (outline-previous-heading))
			   (org-previous-line-empty-p)))))
	 (level (or start-level 1))
	 (make-stars
	  (lambda (_type depth &optional _count)
	    ;; Return the string for the heading, depending on DEPTH
	    ;; of current sub-list.
	    (let ((oddeven-level (+ level (1- depth))))
	      (concat (make-string (if org-odd-levels-only
				       (1- (* 2 oddeven-level))
				     oddeven-level)
				   ?*)
		      " ")))))
    (org-list-to-generic
     list
     (org-combine-plists
      (list :splice t
	    :istart make-stars
	    :icount make-stars
	    :dtstart " " :dtend " "
	    :isep (if blank "\n\n" "\n")
	    :cbon "DONE " :cboff "TODO " :cbtrans "TODO ")
      params))))