GNU bug report logs - #51762
13.0.14; environment formating

Previous Next

Package: auctex;

Reported by: "Pierre L. Nageoire" <devel <at> pollock-nageoire.net>

Date: Thu, 11 Nov 2021 07:15:02 UTC

Severity: normal

Tags: confirmed

Found in version 13.0.14

Done: Ikumi Keita <ikumi <at> ikumi.que.jp>

Bug is archived. No further changes may be made.

Full log


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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Arash Esbati <arash <at> gnu.org>
Cc: 51762 <at> debbugs.gnu.org, "Pierre L. Nageoire" <devel <at> pollock-nageoire.net>
Subject: Re: bug#51762: 13.0.14; environment formating
Date: Sun, 14 Nov 2021 15:19:48 +0900
[Message part 1 (text/plain, inline)]
Hi Arash, thanks for your comment.

>>>>> Arash Esbati <arash <at> 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 (text/x-diff, attachment)]

This bug report was last modified 3 years and 184 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.