Function: org-list-struct-outdent

org-list-struct-outdent is a byte-compiled function defined in org-list.el.gz.

Signature

(org-list-struct-outdent START END STRUCT PARENTS)

Documentation

Outdent items between positions START and END.

STRUCT is the list structure. PARENTS is the alist of items' parents, as returned by org-list-parents-alist.

START is included, END excluded.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-list.el.gz
(defun org-list-struct-outdent (start end struct parents)
  "Outdent items between positions START and END.

STRUCT is the list structure.  PARENTS is the alist of items'
parents, as returned by `org-list-parents-alist'.

START is included, END excluded."
  (let* (acc
	 (out (lambda (cell)
		(let* ((item (car cell))
		       (parent (cdr cell)))
		  (cond
		   ;; Item not yet in zone: keep association.
		   ((< item start) cell)
		   ;; Item out of zone: follow associations in ACC.
		   ((>= item end)
		    (let ((convert (and parent (assq parent acc))))
		      (if convert (cons item (cdr convert)) cell)))
		   ;; Item has no parent: error
		   ((not parent)
		    (error "Cannot outdent top-level items"))
		   ;; Parent is outdented: keep association.
		   ((>= parent start)
		    (push (cons parent item) acc) cell)
		   (t
		    ;; Parent isn't outdented: reparent to grand-parent.
		    (let ((grand-parent (org-list-get-parent
					 parent struct parents)))
		      (push (cons parent item) acc)
		      (cons item grand-parent))))))))
    (mapcar out parents)))