[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51762: 13.0.14; environment formating
From: |
Ikumi Keita |
Subject: |
bug#51762: 13.0.14; environment formating |
Date: |
Sun, 14 Nov 2021 15:19:48 +0900 |
Hi Arash, thanks for your comment.
>>>>> Arash Esbati <arash@gnu.org> writes:
> Thank you for looking into this. The way I understand this regexp:
> "\\([^ \r\n%\\]\\|\\\\%\\)\\([ \t]\\|\\\\\\\\\\)*"
> ^^^^^^^
> is there to exclude the control symbol \%, i.e., being parsed as comment
> start.
I think so, too. Tassilo added it to fix bug#48937 this June.
> Would it help if we generlize the control symbol idea by saying:
> "\\([^ \r\n%\\]\\|\\\\[^a-zA-Z0-9\\]\\)\\([ \t]\\|\\\\\\\\\\)*"
> ^^^^^^^^^^^^^^
I'm afraid that it doesn't match a line
\\% This is a code comment.
, either. Try typing M-q on the following paragraph in latex mode
buffer:
----------------------------------------------------------------------
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec hendrerit
tempor tellus. Donec pretium posuere tellus. Proin quam nisl, tincidunt et,
\\% This is a code comment.
mattis eget, convallis nec, purus.
----------------------------------------------------------------------
>> Maybe we should give up regexp-based approach to find out code comments
>> accurately.
> Are you thinking about `syntax-ppss'?
No, other parts of latex.el ideintify code comments by a different logic
like:
;; A line with some code, followed by a comment?
((and (setq code-comment-start (save-excursion
(beginning-of-line)
(TeX-search-forward-comment-start
(line-end-position))))
(> (point) code-comment-start)
(not (TeX-in-commented-line))
(save-excursion
(goto-char code-comment-start)
;; See if there is at least one non-whitespace character
;; before the comment starts.
(re-search-backward "[^ \t\n]" (line-beginning-position) t)))
So it would be better to follow this logic than to rely on regexp. In
addition, regexp-based approach is easily fooled by percent sign in
\verb, while `TeX-search-forward-comment-start' (which in turn calls
`LaTeX-search-forward-comment-start') takes care of such cases.
I ended up with the attached tentative patch. I hope this doesn't slow
down the filling loop significantly. What do you think about it?
Regards,
Ikumi Keita
patch
Description: tentative fix
- bug#51762: 13.0.14; environment formating, Pierre L. Nageoire, 2021/11/11
- bug#51762: 13.0.14; environment formating, Ikumi Keita, 2021/11/12
- bug#51762: 13.0.14; environment formating, Ikumi Keita, 2021/11/12
- bug#51762: 13.0.14; environment formating, Ikumi Keita, 2021/11/12
- bug#51762: 13.0.14; environment formating, Arash Esbati, 2021/11/13
- bug#51762: 13.0.14; environment formating,
Ikumi Keita <=
- bug#51762: 13.0.14; environment formating, Arash Esbati, 2021/11/15
- bug#51762: 13.0.14; environment formating, Ikumi Keita, 2021/11/16
- bug#51762: 13.0.14; environment formating, Arash Esbati, 2021/11/17
- bug#51762: 13.0.14; environment formating, Ikumi Keita, 2021/11/17
- bug#51762: 13.0.14; environment formating, Ikumi Keita, 2021/11/18
- bug#51762: 13.0.14; environment formating, Ikumi Keita, 2021/11/18
- bug#51762: 13.0.14; environment formating, Arash Esbati, 2021/11/18
- bug#51762: 13.0.14; environment formating, Ikumi Keita, 2021/11/18
- bug#51762: 13.0.14; environment formating, Arash Esbati, 2021/11/19
- bug#51762: 13.0.14; environment formating, Pierre L. Nageoire, 2021/11/20