Subject: bug#46304: 28.0.50; rst-mode fill-paragraph broken in bullet-lists

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 16 Jun 2022 15:02:04 +0200

Thomas Hisch <[email-masked]> writes:

> The indentation in a text block in a bullet-point entry is removed if it
> the 2nd lines starts with a RST directive, e.g. :math:. If you run
> `fill-paragraph` when `point` is somewhere on the first paragraph, the
> indentation before the 2nd line is lost. This is neither the case for
> the 2nd nor the 3rd bullet-point entry in this next example
>
> * asdfasf dafd sfkdkfaslfksdflk mdfa sdfsdf kldf a kdasfd asf
>   :math:`\kappa` dfaskdflsdf dasfdfas df.
>
> * asdfasf dafd sfkdkfaslfksdflk mdfa sdfsdf kldf a kdasfd asf kksadfo
>   mmommmmmasd :math:`\kappa` dfaskdflsdf dasfdfas df.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I can reproduce this in Emacs 29, too -- it seems to be because :math:
is matched by:

    (fld-tag ":" fldnam-tag ":") ; A field marker.

which is part of 

    ;; Paragraphs (`par')
    (par-tag- (:alt itmany-tag fld-tag opt-tag fncdef-tag-2 dir-tag-3 exm-tag)
	      ) ; Tag at the beginning of a paragraph; there may be groups in
		; certain cases.

which is in

  (setq-local adaptive-fill-regexp (rst-re 'hws-tag 'par-tag- "?" 'hws-tag))

I've added Stefan to the CCs; perhaps he has some comments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no