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: multi-character syntactic entities in syntax tables Date: Fri, 26 Apr 2013 22:53:42 +0400 Message-ID: <87sj2d86o9.fsf@yandex.ru> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1367002435 5651 80.91.229.3 (26 Apr 2013 18:53:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Apr 2013 18:53:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: Erik Charlebois Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 26 20:54:00 2013 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 1UVnmN-0007cr-DA for ged-emacs-devel@m.gmane.org; Fri, 26 Apr 2013 20:53:55 +0200 Original-Received: from localhost ([::1]:36520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVnmN-0000T1-47 for ged-emacs-devel@m.gmane.org; Fri, 26 Apr 2013 14:53:55 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVnmH-0000Ss-15 for emacs-devel@gnu.org; Fri, 26 Apr 2013 14:53:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVnmC-0007IA-NE for emacs-devel@gnu.org; Fri, 26 Apr 2013 14:53:48 -0400 Original-Received: from mail-la0-x234.google.com ([2a00:1450:4010:c03::234]:65161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVnmC-0007Hw-GA for emacs-devel@gnu.org; Fri, 26 Apr 2013 14:53:44 -0400 Original-Received: by mail-la0-f52.google.com with SMTP id fd20so3812772lab.25 for ; Fri, 26 Apr 2013 11:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type:x-antivirus :x-antivirus-status; bh=jhxILT1BK2ACHhmtIIpqGVXWXe3qgkzJDWREoTNSuOQ=; b=f78GvDgLyZBmbYe9EVMwuHokS6HKkkUDZIWi+3VPLLQnuup3ciZy99b7M8A1DmtL4V j1OfwIu4koXMEVVAi8P6Xo2RZ/lRH3vVPckuy7IJL4oW2yzC9NiCIYizntPfTwvI/mrc dOLNXz4ppCSdtJaZ0Goo8g3/0ZyOzksca5L5Z8Ha2dnetS0PCzorFq1X0EN82JBf5OMl SUSrMeyMIep4cBhdJ6q9RH1EcKbEK+A47+6JCx6HSPsDwrm/G3u8ua9tHq2+xHc9Lx7Z np1/mOP13TFUfujkbXFjp1I1rCJ6pajf2WS9XrZAPxiRitbW8f0kbGbJBINAAJGJecgn KqQA== X-Received: by 10.112.137.135 with SMTP id qi7mr22272398lbb.117.1367002423099; Fri, 26 Apr 2013 11:53:43 -0700 (PDT) Original-Received: from SOL ([178.252.98.87]) by mx.google.com with ESMTPSA id s1sm3174831lag.2.2013.04.26.11.53.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 11:53:42 -0700 (PDT) In-Reply-To: (Erik Charlebois's message of "Fri, 26 Apr 2013 13:28:42 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-Antivirus: avast! (VPS 130426-0, 26.04.2013), Outbound message X-Antivirus-Status: Clean X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::234 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:159169 Archived-At: Erik Charlebois writes: > 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). > > A mode would use a syntax-propertize-function to tag keywords with > appropriate text properties. So something like Ruby: > > class Foo > def Bar > if condition > ... > end > end > end ruby-mode code could definitely benefit from something like this. > would have syntax classes like: > > (**** www > (** www > (* wwwwwwwww > ... > )** > )** > )** I don't think using syntax-propertize-function is something the person who wrote that TODO entry had in mind, but if we'll use it for that purpose, at least in ruby-mode implementing something like a "generic parenthesis" class should suffice (which would work similarly to generic string and generic comment delimiters), since all non-curly blocks in Ruby end the same way. So, what's the rationale for your, more complex proposal? In what context would treating e, g, i and n in "begin" as parenthesis openers will be useful?