[Top][All Lists]

[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: Sun, 12 Feb 2023 12:18:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Keita,

Ikumi Keita <ikumi@ikumi.que.jp> writes:

> I realized that multiple players are involved in this issue.

First of all, many thanks for your (as always) precise analysis 🙏🏿

> We can fix this inconsistency by the following code:
> ----------------------------------------------------------------------
> (defun LaTeX-verbatim-macro-boundaries ()
> [...]
>       ;; Search backwards for the macro start, unless we are facing one
>       (if (looking-at (concat (regexp-quote TeX-esc) verbatim-regexp))
>           (forward-char 1)
>         (catch 'found
> [...]
> ----------------------------------------------------------------------
> With this fix, `LaTeX-current-verbatim-macro' returns sane result even
> when the point is just before "\verb". It just behave like
> `TeX-current-macro'.

I think this should be our course of action: Make
`LaTeX-current-verbatim-macro' and `TeX-current-macro' work identical.

> Yes, the behavior becomes coherent, but in the undesired direction. :-(

We should take that.

> For consistency, maybe we should modify `TeX-current-macro' and
> `LaTeX-current-verbatim-macro' so that they return nil when the point is
> just before the verbatim macro. However, I'm not yet sure whether such
> change brings about bad side effects.

I agree, we shouldn't touch `TeX-current-macro'.

> Perhaps the safe fix is to tweak `TeX-current-macro' and
> `LaTeX-current-verbatim-macro' so that they accept optional argument for
> use in `LaTeX-verbatim-p'?

Here is another idea: We don't use `LaTeX-verbatim-p' in
`fill-nobreak-predicate', but define two new functions, say
`LaTeX-verbatim-macro-arg-boundaries' and `LaTeX-verbatim-nobreak-p'.
The first one is carved out of `LaTeX-verbatim-macro-boundaries' and
returns the beginning and end positions of the argument, as the name

And `LaTeX-verbatim-nobreak-p' does the following: Check if the possible
break point for filling is inside the range returned by
`LaTeX-verbatim-macro-arg-boundaries' and if
`LaTeX-current-verbatim-macro' on that point returns non-nil, then
inhibit break there (t value), otherwise allow brake (nil value.)

WDYT, does this make sense?

Best, Arash

reply via email to

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