[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56160: 13.1.3; fill breaks verbatim macros not followed with spaces

From: Ikumi Keita
Subject: bug#56160: 13.1.3; fill breaks verbatim macros not followed with spaces
Date: Fri, 01 Jul 2022 13:39:42 +0900

>>>>> Arash Esbati <arash@gnu.org> writes:
> LGTM.  Please go ahead and install it.

Done. :-)

>> Thanks, that makes more sense. Common rule should apply for auto fill as
>> well.

> I'm not sure I understand the last sentence.  Can you elaborate?

AUCTeX doesn't have its own auto fill function. If auto fill is enabled,
`do-auto-fill' does its job. Since it doesn't call
`LaTeX-fill-move-to-break-point', it pays no attention to \verb before
the latest commit.
Now that `fill-nobreak-predicate' contains `LaTeX-verbatim-p' in latex
mode buffer, `do-auto-fill', which call `fill-move-to-break-point',
obeys the same rule with respect to \verb as `LaTeX-fill-*' functions.

> I think we can also adjust `LaTeX-verbatim-p' to handle the FIXME.
> AUCTeX doesn't parse files for \MakeShortVerb, it looks at the chars
> defined in `LaTeX-shortvrb-chars' for delimiters.  We could do something
> like this in `LaTeX-verbatim-p' (addition starts with (when
> LaTeX-shortvrb-chars ...):

> Sorry, there was a thinko in my last message, next try:

This looks good to me. Some minor comments follow.

> (defun LaTeX-verbatim-p (&optional pos)
>         (when LaTeX-shortvrb-chars
>           (let* ((strings (mapcar #'string LaTeX-shortvrb-chars))
>                  (regexp (mapconcat #'regexp-quote strings "\\|"))

In most cases,
          (let ((regexp (concat "[" LaTeX-shortvrb-chars "]"))
would be enough. Is it necessary to take corner cases, in which
`LaTeX-shortvrb-chars' contains ?- or ?], into accounts?

>                  (p (point))
>                  (match (save-excursion
>                           (re-search-forward regexp (line-end-position) t))))
>             (and match
>                  (save-excursion
>                    (cl-oddp (how-many regexp (line-beginning-position) p)))
>                  (save-excursion
>                    (cl-evenp (how-many regexp (line-beginning-position) 
> match)))))))))

This `cl-evenp' always evaluates to non-nil because the first
`re-search-forward' succeeded, doesn't it?

Ikumi Keita
#StandWithUkraine #StopWarInUkraine

reply via email to

[Prev in Thread] Current Thread [Next in Thread]