[Top][All Lists]

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

Re: Writing syntax-propertize-function for strings in code in strings, e

From: Dmitry Gutov
Subject: Re: Writing syntax-propertize-function for strings in code in strings, etc
Date: Fri, 02 Nov 2012 08:54:51 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2

On 28.10.2012 19:46, Stefan Monnier wrote:
Yes, one "push <inner-syntax-table>" and one "pop".
So, I don't see the usefulness of the <inner-syntax-table> value in the
simple case of embedding code in the same language.
It's for the other cases: strings with strings and comments within strings.
Okay. I guess I just don't know [well enough] any languages with different
embedded syntaxes.

I mentioned Postscript as a language that allows strings within strings
(Postscript strings are delimited by parentheses).

I see.

Without knowing the inner syntax table, it's pretty difficult to know
what can be skipped (unless we assume that the "push" can only be marked
with a `syntax-table' text-property).
Indeed. But I think it's a reasonable assumption.

It's not for Postscript strings, I think.

In all cases I can think about the "region opener" is at least two
characters long, and it often depends on the context (like only inside
a string).

OTOH, if we really need to find the inner syntax-table, we could ask
syntax-ppss to give the state right before the "pop", which will also
immediately tell us where is the matching push.
So maybe it's an acceptable workaround (provide a config variable to
either use syntax-ppss or assume that a push can only be within
a syntax-table text-property).

Sounds good to me.

Let's move point inside an embedded code region, maybe several levels
deep.  Now we want to call `forward-sexp'.  How will it know the
effective syntax-table value at that position?

That's not a new problem, actually, since if you start a `forward-sexp'
from within a string or within a comment you already get
similar problems.

True, although with those it's mostly a non-problem, AFAICT: jumping forward or back from comments works just fine, and jumping solely between strings makes a certain amount of sense.

PS: My secret longer-term agenda for world domination might include
     using push/pop for all strings and comments as well.

Could you point to the use case?
I think this might be good for e.g. comments in regexps, but that's already going to be one of the uses for "code in strings", no?

P.S. Sorry for offtopic, but I've been receiving this kind of "message undelivered" messages for the past few weeks from address@hidden, one for each email I sent you, each with considerable delay:

<address@hidden>: connect to
    perlin.IRO.UMontreal.CA[]:25: Connection timed out

Is this a problem on your end, or should I switch to another SMTP server?


reply via email to

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