Function: rst-insert-list-new-tag
rst-insert-list-new-tag is a byte-compiled function defined in
rst.el.gz.
Signature
(rst-insert-list-new-tag TAG)
Documentation
Insert first item of a new list tagged with TAG.
Adding a new list might consider three situations:
(a) Current line is a blank line.
(b) Previous line is a blank line.
(c) Following line is a blank line.
When (a) and (b), just add the new list at current line.
when (a) and not (b), a blank line is added before adding the new list.
When not (a), first forward point to the end of the line, and add two blank lines, then add the new list.
Other situations are just ignored and left to users themselves.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
;; End of borrow.
;; FIXME: All the following code should not consider single lines as items but
;; paragraphs as reST does.
(defun rst-insert-list-new-tag (tag)
;; testcover: ok.
"Insert first item of a new list tagged with TAG.
Adding a new list might consider three situations:
(a) Current line is a blank line.
(b) Previous line is a blank line.
(c) Following line is a blank line.
When (a) and (b), just add the new list at current line.
when (a) and not (b), a blank line is added before adding the new list.
When not (a), first forward point to the end of the line, and add two
blank lines, then add the new list.
Other situations are just ignored and left to users themselves."
;; FIXME: Following line is not considered at all.
(let ((pfx-nls
;; FIXME: Doesn't work properly for white-space line. See
;; `rst-insert-list-new-BUGS'.
(if (rst-forward-line-looking-at 0 'lin-end)
(if (not (rst-forward-line-looking-at -1 'lin-end #'not))
0
1)
2)))
(end-of-line)
;; FIXME: The indentation is not fixed to a single space by the syntax. May
;; be this should be configurable or rather taken from the context.
(insert (make-string pfx-nls ?\n) tag " ")))