all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: npostavs@users.sourceforge.net
Cc: Peter Milliken <peter.milliken@gmail.com>, 25903@debbugs.gnu.org
Subject: bug#25903: Question re syntax tables and unexpected behaviour in C/C++ major mode
Date: Thu, 2 Mar 2017 20:10:42 +0000	[thread overview]
Message-ID: <20170302201041.GA989@acm> (raw)
In-Reply-To: <87o9xkb7w2.fsf@users.sourceforge.net>

Hello, Peter and Noam

On Wed, Mar 01, 2017 at 23:49:17 -0500, npostavs@users.sourceforge.net wrote:
> Peter Milliken <peter.milliken@gmail.com> 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	other threads:[~2017-03-02 20:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 22:04 bug#25903: Question re syntax tables and unexpected behaviour in C/C++ major mode Peter Milliken
2017-03-02  4:32 ` Glenn Morris
2017-03-02  4:49 ` npostavs
2017-03-02 20:10   ` Alan Mackenzie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170302201041.GA989@acm \
    --to=acm@muc.de \
    --cc=25903@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    --cc=peter.milliken@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.