unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Writing syntax-propertize-function for strings in code in strings, etc
Date: Fri, 02 Nov 2012 08:54:51 +0400	[thread overview]
Message-ID: <5093521B.4090309@yandex.ru> (raw)
In-Reply-To: <jwvwqyar4gu.fsf-monnier+emacs@gnu.org>

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 
mailer-daemon@yandex.ru, one for each email I sent you, each with 
considerable delay:

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

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

--Dmitry



  reply	other threads:[~2012-11-02  4:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-08  3:23 Writing syntax-propertize-function for strings in code in strings, etc Dmitry Gutov
2012-09-08 19:31 ` Stefan Monnier
2012-09-09  0:13   ` Dmitry Gutov
     [not found]   ` <504FE870.7070002@yandex.ru>
     [not found]     ` <jwvlietxls1.fsf-monnier+emacs@gnu.org>
2012-10-26 19:18       ` Dmitry Gutov
2012-10-26 20:41         ` Stefan Monnier
2012-10-26 21:52           ` Dmitry Gutov
2012-10-28 15:46             ` Stefan Monnier
2012-11-02  4:54               ` Dmitry Gutov [this message]
2012-11-15  1:40                 ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=5093521B.4090309@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).