[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#61400: Different filling for verbatim macros
From: |
Arash Esbati |
Subject: |
bug#61400: Different filling for verbatim macros |
Date: |
Fri, 10 Feb 2023 12:41:12 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Tassilo Horn <tsdh@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---
- bug#61400: Different filling for verbatim macros, Arash Esbati, 2023/02/10
- bug#61400: Different filling for verbatim macros, Tassilo Horn, 2023/02/10
- bug#61400: Different filling for verbatim macros, Arash Esbati, 2023/02/10
- bug#61400: Different filling for verbatim macros, Tassilo Horn, 2023/02/10
- bug#61400: Different filling for verbatim macros, Ikumi Keita, 2023/02/10
- bug#61400: Different filling for verbatim macros,
Arash Esbati <=
- bug#61400: Different filling for verbatim macros, Ikumi Keita, 2023/02/11
- bug#61400: Different filling for verbatim macros, Arash Esbati, 2023/02/12
- bug#61400: Different filling for verbatim macros, Ikumi Keita, 2023/02/12
- bug#61400: Different filling for verbatim macros, Ikumi Keita, 2023/02/13
- bug#61400: Different filling for verbatim macros, Arash Esbati, 2023/02/13
- bug#61400: Different filling for verbatim macros, Ikumi Keita, 2023/02/14
- bug#61400: Different filling for verbatim macros, Arash Esbati, 2023/02/14
- bug#61400: Different filling for verbatim macros, Ikumi Keita, 2023/02/15
- bug#61400: Different filling for verbatim macros, Arash Esbati, 2023/02/15
- bug#61400: Different filling for verbatim macros, Ikumi Keita, 2023/02/15