Function: org-list-struct-fix-item-end
org-list-struct-fix-item-end is a byte-compiled function defined in
org-list.el.gz.
Signature
(org-list-struct-fix-item-end STRUCT)
Documentation
Verify and correct each item end position in STRUCT.
This function modifies STRUCT.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-list.el.gz
(defun org-list-struct-fix-item-end (struct)
"Verify and correct each item end position in STRUCT.
This function modifies STRUCT."
(let (end-list acc-end)
(pcase-dolist (`(,pos . ,_) struct)
(let ((ind-pos (org-list-get-ind pos struct))
(end-pos (org-list-get-item-end pos struct)))
(unless (assq end-pos struct)
;; To determine real ind of an ending position that is not
;; at an item, we have to find the item it belongs to: it is
;; the last item (ITEM-UP), whose ending is further than the
;; position we're interested in.
(let ((item-up (assoc-default end-pos acc-end #'>)))
(push (cons
;; Else part is for the bottom point.
(if item-up (+ (org-list-get-ind item-up struct) 2) 0)
end-pos)
end-list)))
(push (cons ind-pos pos) end-list)
(push (cons end-pos pos) acc-end)))
(setq end-list (sort end-list (lambda (e1 e2) (< (cdr e1) (cdr e2)))))
(org-list-struct-assoc-end struct end-list)))