emacs-devel
[Top][All Lists]
Advanced

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

Re: multi-character syntactic entities in syntax tables


From: Erik Charlebois
Subject: Re: multi-character syntactic entities in syntax tables
Date: Fri, 26 Apr 2013 17:37:47 -0400

ruby-forward-sexp works fine. It's more for things like % (under vim emulation, I'm not sure what the Emacs-equivalent is) to jump to the matching brace and show-paren-mode.


On Fri, Apr 26, 2013 at 3:26 PM, Stefan Monnier <address@hidden> wrote:
> One of the items in etc/TODO is:
> ** Beefed-up syntax-tables.
> *** recognize multi-character syntactic entities like `begin' and `end'.

> Lately I'm using languages where this would be quite useful and would be
> interested in adding support. Before I dive in, are there any strong
> opinions about how this should be implemented?

> The approach I was thinking of taking is defining a new syntax character
> class (let's say, *) which inherits from the previous character
> (recursively if the previous character is *). The important distinction is
> that they would not be treated as a new instance of that syntax class, so
> point movement by syntax class or paren matching would work (e.g. begin
> would be (****, and would only add 1 level of paren nesting).

I see.  So you'd rely on syntax-propertize-function to recognize those
multi-char entities and label them with one of the current syntaxes for
the first char and "*" for the other ones, thus labelling the symbol as
forming a single entity.

That's interesting.  The main drawback I see with it is the heavy
reliance on syntax-propertize, which can imply a significant performance
cost when jumping to the end of a largish buffer (forcing the whole
buffer to be lexed).

But it sounds like an attractive "easy" way to extend syntax tables to
support multi-char entities.

BTW: have you tried to set forward-sexp-function to something like
ruby-forward-sexp?


        Stefan


reply via email to

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