Function: rst-find-begs
rst-find-begs is a byte-compiled function defined in rst.el.gz.
Signature
(rst-find-begs BEG END RST-RE-BEG)
Documentation
Return the positions of begs in region BEG to END.
RST-RE-BEG is a rst-re argument and matched at the beginning of
a line. Return a list of (POINT . COLUMN) where POINT gives the
point after indentation and COLUMN gives its column. The list is
ordered by POINT.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
;; FIXME: This is wrong because it misses prefixed lines without intervening
;; new line. See `rst-straighten-bullets-region-BUGS' and
;; `rst-find-begs-BUGS'.
(defun rst-find-begs (beg end rst-re-beg)
;; testcover: ok.
"Return the positions of begs in region BEG to END.
RST-RE-BEG is a `rst-re' argument and matched at the beginning of
a line. Return a list of (POINT . COLUMN) where POINT gives the
point after indentation and COLUMN gives its column. The list is
ordered by POINT."
(let (r)
(save-match-data
(save-excursion
;; FIXME refactoring: Consider making this construct a macro looping
;; over the lines.
(goto-char beg)
(1value
(rst-forward-line-strict 0))
(while (< (point) end)
(let ((clm (current-indentation)))
;; FIXME refactoring: Consider using `rst-forward-line-looking-at'.
(when (and
(looking-at (rst-re rst-re-beg)) ; Start found
(not (rst-forward-line-looking-at
-1 'lin-end
(lambda (mtcd) ; Previous line exists and is...
(and
(not mtcd) ; non-empty,
(<= (current-indentation) clm) ; less indented
(not (and (= (current-indentation) clm)
; not a beg at same level.
(looking-at (rst-re rst-re-beg)))))))))
(back-to-indentation)
(push (cons (point) clm) r)))
(1value ; At least one line is moved in this loop.
(rst-forward-line-strict 1 end)))))
(nreverse r)))