[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25903: Question re syntax tables and unexpected behaviour in C/C++ m

From: Alan Mackenzie
Subject: bug#25903: Question re syntax tables and unexpected behaviour in C/C++ major mode
Date: Thu, 2 Mar 2017 20:10:42 +0000
User-agent: Mutt/1.7.2 (2016-11-26)

Hello, Peter and Noam

On Wed, Mar 01, 2017 at 23:49:17 -0500, address@hidden wrote:
> Peter Milliken <address@hidden> writes:

> > My code works fine in buffers that have Python, Ada and Lisp major
> > modes but it experiences difficulties in buffers with C/C++ major
> > mode. Basically, when in a C/C++ buffer, the code locates text within
> > "<>" pairs as well as "{}"/"[]" pairs. I really don't want my code to
> > have an (ugly) exception case where it tests "if in C/C++ mode then
> > check if <> has been detected and skip over them and continue looking
> > for {}/[] pairs"

Depending on your exact usage, it might be well worth your while leaving
the stuff for strings and comments in your syntax table.

> You'll probably have to though.  In C++, "<" matches ">" when they
> denote template arguments.  cc-mode implements this by adding text
> properties to those characters so that they have pair syntax.  Changing
> the syntax table doesn't change the text properties, so for those
> characters, the syntax stays the same.

What can be done, though, is to disable the effect of the syntax-table
text property by binding parse-sexp-lookup-properties to nil.

> Use C-u C-x = to check the syntax and properties of a particular
> character.

Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]