From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Writing syntax-propertize-function for strings in code in strings, etc Date: Fri, 02 Nov 2012 08:54:51 +0400 Message-ID: <5093521B.4090309@yandex.ru> References: <87a9x1jiyu.fsf@yandex.ru> <504FE870.7070002@yandex.ru> <508AE1F2.4000408@yandex.ru> <508B0606.5040209@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1351832099 10763 80.91.229.3 (2 Nov 2012 04:54:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Nov 2012 04:54:59 +0000 (UTC) Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 02 05:55:08 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TU9Hd-000286-Cm for ged-emacs-devel@m.gmane.org; Fri, 02 Nov 2012 05:55:05 +0100 Original-Received: from localhost ([::1]:60551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU9HU-0005XA-Ot for ged-emacs-devel@m.gmane.org; Fri, 02 Nov 2012 00:54:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU9HS-0005X4-F9 for emacs-devel@gnu.org; Fri, 02 Nov 2012 00:54:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU9HR-0002wH-Bx for emacs-devel@gnu.org; Fri, 02 Nov 2012 00:54:54 -0400 Original-Received: from forward14.mail.yandex.net ([95.108.130.92]:35122) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU9HQ-0002tR-LE for emacs-devel@gnu.org; Fri, 02 Nov 2012 00:54:53 -0400 Original-Received: from smtp12.mail.yandex.net (smtp12.mail.yandex.net [95.108.131.191]) by forward14.mail.yandex.net (Yandex) with ESMTP id 37E5A198125B; Fri, 2 Nov 2012 08:54:46 +0400 (MSK) Original-Received: from smtp12.mail.yandex.net (localhost [127.0.0.1]) by smtp12.mail.yandex.net (Yandex) with ESMTP id 113F716A03E7; Fri, 2 Nov 2012 08:54:46 +0400 (MSK) Original-Received: from 5x166x242x229.dynamic.spb.ertelecom.ru (5x166x242x229.dynamic.spb.ertelecom.ru [5.166.242.229]) by smtp12.mail.yandex.net (nwsmtp/Yandex) with ESMTP id sjmKQYjX-sjmKjKD6; Fri, 2 Nov 2012 08:54:45 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1351832086; bh=ytaIxOnUZsZQkVRCUotbVlGh3UzGokCyn3L2++ews8Y=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=OVC18iGqCgl9ikceSWkf8LB5p0uzQEokValvJKTPbUqFdA3yexBJEusYEpUCiT2kH eDrKS6dswJ9cjhUqAENvdOBiktUIb0OsipLypi7NOlqSvhI5EKXOVIuGLSSKyUWe59 x5fdUSItBjx5SVoIor3UcBd82pDjw5zL68sAwJaY= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 95.108.130.92 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:154622 Archived-At: On 28.10.2012 19:46, Stefan Monnier wrote: >>>>> Yes, one "push " and one "pop". >>>> So, I don't see the usefulness of the 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: : 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