|
From: | Dmitry Gutov |
Subject: | bug#18826: 24.3.94; c++-mode bad indentation after programmatic insert with locally changed syntax table |
Date: | Sun, 26 Oct 2014 05:45:42 +0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
On 10/26/2014 02:34 AM, Alan Mackenzie wrote:
Why do you think it should be harmless?
Because the syntax table change is temporary and its effect should be limited to my code?
. The c-in-sws and c-is-sws indicate that the semicolon has been recognised and marked as syntactic whitespace. The second line thus gets parsed as "statement-cont", i.e. a continued statement, so it gets indented an extra level.
Yes, I see that. But how does this happen?
If you cripple C++ Mode by substituting a wrong syntax table, you shouldn't be too surprised when things go "wrong". This seems like one of these "well, don't do that, then" bugs. Question: why do you want to play around with the syntax table in this manner? What are you trying to achieve?
I'm using a different syntax table for sexp movement, where it's necessary for both parens and angle brackets to have paren syntax class. In the actual code I modify the text after it's inserted, and `backward-sexp' is used two times to find necessary search bounds.
https://github.com/company-mode/company-mode/blob/42012730da15ffaef7c61722475040babed15332/company-template.el#L155-L173
[Prev in Thread] | Current Thread | [Next in Thread] |