The behavior of LaTeX-fill-* seems to break when used with a verbatim
macro which is not followed by a space.
A minimal example is a TeX file containing only the following line
Lorem ipsum dolor sit amet, consectetur adipiscing elit, \verb|sed do|eiusmod tempor
Running the LaTeX-fill-buffer command yields the following, which does not compile since a line break is inserted inside a verbatim macro.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, \verb|sed
do|eiusmod tempor
Adding a space after the macro solves the issue and the following file is filled properly.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, \verb|sed do| eiusmod tempor
My original use-case was with a piece of code of the following form, where adding the space is not really an option.
\lstinline|a <=|~$b$
A possible workaround is to replace the space inside the verb macro with a no-break space (U+00A0)
Many thanks,
Thibaut