[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The current state of the comment-cache branch
From: |
Eli Zaretskii |
Subject: |
Re: The current state of the comment-cache branch |
Date: |
Sat, 24 Dec 2016 14:00:03 +0200 |
> Date: Sat, 24 Dec 2016 11:36:20 +0000
> Cc: emacs-devel <address@hidden>, Eli Zaretskii <address@hidden>
> From: Alan Mackenzie <address@hidden>
>
> > Could you or someone else explain why an open paren in column 0 can affect
> > the parsing of syntax in cc-mode at all? After all, such parens have no
> > special syntactic nor semantic meaning in C nor C++.
>
> It is a convention established in Emacs around ?40 years ago, that such
> an open paren signalled the start of a defun. This sped Emacs up
> enormously, since the alternative was searching back to the beginning of
> the buffer to check whether the paren was at the top level.
>
> Currently, the only piece of low-level code which uses this convention is
> back_comment in .../src/syntax.c. This scans backward over a comment to
> its beginning. Scanning backwards is difficult, because you can't really
> tell whether a string quote is contained within a comment, or a comment
> marker might be contained within a string, .... back_comment is
> heuristic, and sort of works OK. But it uses the open defun convention
> to speed itself up.
I think one missing piece of the puzzle, which is what confused Elias,
is that open-paren-in-column-0-is-defun-start is not only about '(',
it's about any character that has the "open parenthesis" syntax class
under the current syntax tables. And in C mode, that includes '{' and
'[', with the former being the important one. I think.
- Re: The current state of the comment-cache branch, (continued)
- Re: The current state of the comment-cache branch, Eli Zaretskii, 2016/12/24
- Re: The current state of the comment-cache branch, Alan Mackenzie, 2016/12/24
- Re: The current state of the comment-cache branch, Eli Zaretskii, 2016/12/24
- Re: The current state of the comment-cache branch, Alan Mackenzie, 2016/12/24
- Re: The current state of the comment-cache branch, Elias Mårtenson, 2016/12/24
- Re: The current state of the comment-cache branch, Alan Mackenzie, 2016/12/24
- Re: The current state of the comment-cache branch,
Eli Zaretskii <=
- Re: The current state of the comment-cache branch, Andreas Röhler, 2016/12/24
- Message not available
- Message not available
- Re: The current state of the comment-cache branch, Elias Mårtenson, 2016/12/24
- Re: The current state of the comment-cache branch, Alan Mackenzie, 2016/12/27
- Re: The current state of the comment-cache branch, Eli Zaretskii, 2016/12/28
- Re: The current state of the comment-cache branch, Alan Mackenzie, 2016/12/28
- Re: The current state of the comment-cache branch, Nikolaus Rath, 2016/12/28
- Re: The current state of the comment-cache branch, Eli Zaretskii, 2016/12/28
- Re: The current state of the comment-cache branch, Nikolaus Rath, 2016/12/28
- Re: The current state of the comment-cache branch, Eli Zaretskii, 2016/12/28
- Re: The current state of the comment-cache branch, Nikolaus Rath, 2016/12/29