[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18826: 24.3.94; c++-mode bad indentation after programmatic insert w
From: |
Stefan Monnier |
Subject: |
bug#18826: 24.3.94; c++-mode bad indentation after programmatic insert with locally changed syntax table |
Date: |
Sun, 26 Oct 2014 13:03:44 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
>>> (with-syntax-table (make-char-table 'syntax-table nil)
>>> (modify-syntax-entry ?\( "(")
>>> (modify-syntax-entry ?\) ")")
>>> (modify-syntax-entry ?< "(")
>>> (modify-syntax-entry ?> ")")
>>> (insert "fgets(0, 1, 2)"))
>>
>> Why do that?
> To include angle brackets in paren syntax class.
But `insert' doesn't use that temporary syntax-table (aside from
indirect use in before/after-change-functions, obviously). So why use
`with-syntax-table' around a call to `insert'?
> It seems that I should only change the current syntax table only
> around the `backward-sexp' and `parse-partial-sexp' calls there, but
> not when doing any text modification.
Yes. And even then, this should not be necessary since the major mode
already does it (or should do it) for you.
Stefan
bug#18826: 24.3.94; c++-mode bad indentation after programmatic insert with locally changed syntax table, Stefan Monnier, 2014/10/25
Message not available