GNU bug report logs -
#61400
Different filling for verbatim macros
Previous Next
Reported by: Arash Esbati <arash <at> gnu.org>
Date: Fri, 10 Feb 2023 08:53:01 UTC
Severity: normal
Done: Arash Esbati <arash <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Tassilo Horn <tsdh <at> gnu.org> writes:
> Yes, I can. BTW, only the last sentence is broken correctly, all others
> are wrapped around at a too early position.
Thanks for checking.
> Hm, (fill-nobreak-p) returns nil only on the \ of the \verb|bar| but
> returns non-nil on each \ of the other verbatim macros. (I can't look
> any further now so it's your turn again. ;-))
I think I've got it: `LaTeX-verbatim-p' does its job as a predicate, but
for filling, it should only return non-nil when point is inside the
argument, and not when point is in front of the \verb macro itself, this
is what `fill-move-to-break-point' does. Try this file: Eval the forms
and then fill the other lines.
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{url}
\usepackage{fvextra}
\begin{document}
\begin{verbatim}
(defun LaTeX-verbatim-nobreak-p (&optional pos)
"Return non-nil if position POS is in a verbatim-like construct."
(when pos (goto-char pos))
(save-match-data
(or (progn
(syntax-propertize (point))
(nth 3 (syntax-ppss)))
(member (LaTeX-current-verbatim-macro)
(append
(LaTeX-verbatim-macros-with-delims)
(LaTeX-verbatim-macros-with-braces))))))
(setq-local fill-nobreak-predicate
#'LaTeX-verbatim-nobreak-p)
\end{verbatim}
Now we can write some text foo and \path|bar|
Now we can write some text foo and \path|bar|
Now we can write some text foo and \Verb{bar}
Now we can write some text foo and \Verb|bar|
Now we can write some text foo and \verb|bar|
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% fill-column: 40
%%% End:
--8<---------------cut here---------------end--------------->8---
This bug report was last modified 2 years and 156 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.