Function: rst-adjust-region
rst-adjust-region is an interactive and byte-compiled function defined
in rst.el.gz.
Signature
(rst-adjust-region DEMOTE)
Documentation
Promote the section titles within the region.
With argument DEMOTE or a prefix argument, demote the section
titles instead. The algorithm used at the boundaries of the
hierarchy is similar to that used by rst-adjust-section.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
(defun rst-adjust-region (demote)
;; testcover: ok.
"Promote the section titles within the region.
With argument DEMOTE or a prefix argument, demote the section
titles instead. The algorithm used at the boundaries of the
hierarchy is similar to that used by `rst-adjust-section'."
(interactive "P")
(rst-reset-section-caches)
(let* ((beg (region-beginning))
(end (region-end))
(ttls-reg (cl-remove-if-not
(lambda (ttl)
(and
(>= (rst-Ttl-contains ttl beg) 0)
(< (rst-Ttl-contains ttl end) 0)))
(rst-all-ttls))))
(save-excursion
;; Apply modifications.
(rst-destructuring-dolist
((marker &rest hdr
&aux (hier (rst-hdr-hierarchy)))
(mapcar (lambda (ttl)
(cons (copy-marker (rst-Ttl-get-title-beginning ttl))
(rst-Ttl-hdr ttl)))
ttls-reg))
(set-marker
(goto-char marker) nil)
;; `rst-next-hdr' cannot return nil because we apply to a section
;; header so there is some hierarchy.
(rst-update-section (rst-next-hdr hdr hier nil demote)))
(setq deactivate-mark nil))))