GNU bug report logs - #18826
24.3.94; c++-mode bad indentation after programmatic insert with locally changed syntax table

Previous Next

Packages: cc-mode, emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Sat, 25 Oct 2014 14:27:02 UTC

Severity: normal

Found in version 24.3.94

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 18826 <at> debbugs.gnu.org
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
>>> (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




This bug report was last modified 10 years and 288 days ago.

Previous Next


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