Function: org-list-write-struct
org-list-write-struct is a byte-compiled function defined in
org-list.el.gz.
Signature
(org-list-write-struct STRUCT PARENTS &optional OLD-STRUCT)
Documentation
Correct bullets, checkboxes and indentation in list at point.
STRUCT is the list structure. PARENTS is the alist of parents,
as returned by org-list-parents-alist.
When non-nil, optional argument OLD-STRUCT is the reference structure of the list. It should be provided whenever STRUCT doesn't correspond anymore to the real list in buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-list.el.gz
(defun org-list-write-struct (struct parents &optional old-struct)
"Correct bullets, checkboxes and indentation in list at point.
STRUCT is the list structure. PARENTS is the alist of parents,
as returned by `org-list-parents-alist'.
When non-nil, optional argument OLD-STRUCT is the reference
structure of the list. It should be provided whenever STRUCT
doesn't correspond anymore to the real list in buffer."
;; Order of functions matters here: checkboxes and endings need
;; correct indentation to be set, and indentation needs correct
;; bullets.
;;
;; 0. Save a copy of structure before modifications
(let ((old-struct (or old-struct (copy-tree struct))))
;; 1. Set a temporary, but coherent with PARENTS, indentation in
;; order to get items endings and bullets properly
(org-list-struct-fix-ind struct parents 2)
;; 2. Fix each item end to get correct prevs alist.
(org-list-struct-fix-item-end struct)
;; 3. Get bullets right.
(let ((prevs (org-list-prevs-alist struct)))
(org-list-struct-fix-bul struct prevs)
;; 4. Now get real indentation.
(org-list-struct-fix-ind struct parents)
;; 5. Eventually fix checkboxes.
(org-list-struct-fix-box struct parents prevs))
;; 6. Apply structure modifications to buffer.
(org-list-struct-apply-struct struct old-struct))
;; 7. Return the updated structure
struct)