GNU bug report logs - #61400
Different filling for verbatim macros

Previous Next

Package: auctex;

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


Message #38 received at 61400 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: 61400 <at> debbugs.gnu.org, Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#61400: Different filling for verbatim macros
Date: Sun, 12 Feb 2023 12:18:31 +0100
Hi Keita,

Ikumi Keita <ikumi <at> 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
suggests.

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




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.