[Top][All Lists]

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

bug#61400: Different filling for verbatim macros

From: Ikumi Keita
Subject: bug#61400: Different filling for verbatim macros
Date: Fri, 10 Feb 2023 19:46:58 +0900

>>>>> Tassilo Horn <tsdh@gnu.org> writes:
>> It moves the point to different positions.  In the example above, put
>> point after \path{bar} and do:
>> M-: (fill-move-to-break-point (line-beginning-position)) RET
>> and the point before and.  Now go after \verb|bar| and do the same, no
>> is point after and.  Can you reproduce this?

> Yes, I can.

I can as well.

> 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 did repeated edebug and found that `LaTeX-verbatim-p' is the culprit.
When the point is just before \path{bar}, (LaTeX-verbatim-p) returns
non-nil and `fill-nobreak-bredicate' hook tells "Don't break here". On
the other hand, if the poinst is just before \verb|bar|,
(LaTeX-verbatim-p) returns nil.

Here is current definition of `LaTeX-verbatim-p':
| (defun LaTeX-verbatim-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)
|                 (LaTeX-verbatim-macros-with-delims))
|         (member (TeX-current-macro) (LaTeX-verbatim-macros-with-braces))
|         (member (LaTeX-current-environment) (LaTeX-verbatim-environments)))))
After all, the difference comes from subtle difference between
`LaTeX-current-verbatim-macro' and `TeX-current-macro'. When the point
is just before the leading backslash, they returns:
                             | path  | verb  |
LaTeX-current-verbatim-macro | ""    | ""    |
TeX-current-macro            | "path"| "verb"|

In this context, it doesn't seem appropriate `TeX-current-macro' returns

Ikumi Keita
#StandWithUkraine #StopWarInUkraine

reply via email to

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