Function: rst-straighten-bullets-region
rst-straighten-bullets-region is an interactive and byte-compiled
function defined in rst.el.gz.
Signature
(rst-straighten-bullets-region BEG END)
Documentation
Make all the bulleted list items in the region from BEG to END consistent.
Use this after you have merged multiple bulleted lists to make
them use the preferred bullet characters given by
rst-preferred-bullets for each level. If bullets are found on
levels beyond the rst-preferred-bullets list, they are not
modified.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
(defun rst-straighten-bullets-region (beg end)
;; testcover: ok.
"Make all the bulleted list items in the region from BEG to END consistent.
Use this after you have merged multiple bulleted lists to make
them use the preferred bullet characters given by
`rst-preferred-bullets' for each level. If bullets are found on
levels beyond the `rst-preferred-bullets' list, they are not
modified."
(interactive "r")
(save-excursion
(let (clm2pnts) ; Map a column to a list of points at this column.
(rst-destructuring-dolist
((point &rest column
&aux (found (assoc column clm2pnts)))
(rst-find-begs beg end 'bul-beg))
(if found
;;; (push point (cdr found)) ; FIXME: Doesn't work with `testcover'.
(setcdr found (cons point (cdr found))) ; Synonym.
(push (list column point) clm2pnts)))
(rst-destructuring-dolist
((bullet _clm &rest pnts)
;; Zip preferred bullets and sorted columns associating a bullet
;; with a column and all the points this column is found.
(cl-mapcar (lambda (bullet clm2pnt)
(cons bullet clm2pnt))
rst-preferred-bullets
(sort clm2pnts #'car-less-than-car)))
;; Replace the bullets by the preferred ones.
(dolist (pnt pnts)
(goto-char pnt)
;; FIXME: Assumes bullet to replace is a single char.
(delete-char 1)
(insert bullet))))))