[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: Tue, 14 Feb 2023 11:30:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Keita,

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

> OK, then another candidate is the attached patch.


> This keeps the current behavior of `LaTeX-verbatim-p' and introduces a
> new function `LaTeX-verbatim-nobreak-p' as you suggested in your
> previous message.
> However, I'm a bit reluctant.
> 1. If `LaTeX-verbatim-p' should return non-nil at just before
>    "\verb", then it should also do so just before "\begin{verbatim}" for
>    consistency, shouldn't it?
> 2. Suppose that you type "$" just before "\verb...". Then
>    `TeX-insert-dollar' inserts only one "$" instead of "$$" under the
>    current behavior of `LaTeX-verbatim-p', because `TeX-insert-dollar'
>    uses `TeX-verbatim-p'. I think it's unexpected. 

I think we have everything we need now so we can change the behavior of
`LaTeX-verbatim-p' acc. to what you describe above because:

 • `LaTeX-verbatim-macro-boundaries' returns the inner (nice!) and outer
   boundries of a macro, incl. the backslash
 • `LaTeX-current-verbatim-macro' returns the name of the macro

So one can extract all the information needed.

> Thanks, I incorporated it with slight modification in the attached
> patch.


> In my previous patch, it's correct because I removed the chunk
>       (if (looking-at (concat (regexp-quote TeX-esc) verbatim-regexp))
>           (forward-char 1)
> from `LaTeX-verbatim-macro-boundaries'. :-)


Note that I had to apply the patch attached on top of yours in order to
get it working (some trouble with parens).  I've also adjusted the
comment (the optional arg of \lstinline was already there).  And also I

  (delimiter (if (= (char-after end) ?\[)


  (delimiter (if (string= (string (char-after end)) LaTeX-optop)

in case that character changes.

> (By the way, I noticed that `LaTeX-verbatim-p' raises error when "\verb"
> is at the end of the buffer without delimiters and its contents "|...|".
> In fact `LaTeX-verbatim-macro-boundaries' and
> `LaTeX-current-verbatim-macro' raise the same error. The reason is that
> `LaTeX-verbatim-macro-boundaries' presumes there is nonempty string
> after the macro body. Should we cater for such corner case?)

I'd say let's fix the issue at hand and then see if others complain and
there is a real use for this corner case, and then we can touch that.
Does it make sense?

Best, Arash

Attachment: patchpatch
Description: Binary data

reply via email to

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