From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.devel Subject: Re: emacs: are multi-char parentheses possible? Date: Tue, 10 Jun 2014 07:13:51 +0200 Message-ID: <5396940F.4080408@online.de> References: 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 1402377280 11765 80.91.229.3 (10 Jun 2014 05:14:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Jun 2014 05:14:40 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 10 07:14:33 2014 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 1WuEOH-0001Kn-CH for ged-emacs-devel@m.gmane.org; Tue, 10 Jun 2014 07:14:33 +0200 Original-Received: from localhost ([::1]:36603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuEOG-0005IS-VE for ged-emacs-devel@m.gmane.org; Tue, 10 Jun 2014 01:14:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuEO6-0005IH-Ns for emacs-devel@gnu.org; Tue, 10 Jun 2014 01:14:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WuENz-000787-8B for emacs-devel@gnu.org; Tue, 10 Jun 2014 01:14:22 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.130]:49815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuENy-00077n-VM for emacs-devel@gnu.org; Tue, 10 Jun 2014 01:14:15 -0400 Original-Received: from [192.168.178.32] (brln-4d0c3672.pool.mediaWays.net [77.12.54.114]) by mrelayeu.kundenserver.de (node=mreue006) with ESMTP (Nemesis) id 0MAGGD-1X5Y7B1SFV-00BOjl; Tue, 10 Jun 2014 07:14:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.5.0 In-Reply-To: X-Provags-ID: V02:K0:BkcjVbw684OmNgkjipuxRoNX13EpPdhJiistiJNHjFT W8Q8+p0z42pK2DQJsUUJfw4rhPAmer1QjbVNvOhCgFcyDTJfTR FNd47v1otskBVdH7cwZgVBn1Vd98D47JCPkSkze1+FK6H2R0aL 3exTKCc1CV5OAgmImvi1en6FGJ3mbsyHCQ5C/y7u2+TU3Gucpu ipFjobfQtCLvnPSqn8qZTRIbFDLmtGLHGhCa87mP8xCo8pYmln IngqJ4Mlhua+usxY1RzkNJKhuwha2dXaER1xRbQCiJpwGkoc7+ MJp52wh1wd9j1SlHFo23hvqrAunDzO5YmMN6byAtrdz5PIwJk3 ZhZmN7D6db15v4sUsyEdjvmbpV5rKjuPMjOQXHZ8o X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.126.130 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:172430 Archived-At: On 09.06.2014 17:38, Stefan Monnier wrote: >> Do you know if it is possible for Emacs to handle a pair of multi-char >> parentheses? > > Yes, I do. I also know the answer is not just a plain boolean. > >> Take << and >> for example, >> >> (setq-local syntax-propertize-function (syntax-propertize-rules >> ("\\(<\\)<" (1 "(>")) >> (">\\(>\\)" (1 ")<")))) >> >> show-paren-mode can highlight "<<" and ">>" but up-list aren't aware of >> them. > > up-list should handle this just as well as show-paren and > for/backward-sexp (and does, in my tests). > > Maybe you tried a "forward up-list" where the closing ">>" hadn't yet been > syntax-propertized? > > This technique has some downsides, but in the case of << ... >> it might > work well enough. > > For things like "begin...end" it's more annoying (e.g. backward word > will stop right between the "b" and the "egin" and forward-word will > stop right between "en" and "d"). For those, SMIE might be a better > option (which uses hooks in show-paren and forward-sexp to try and make > them do The Right Thing, tho the up-list case is only 90% working). > > > Stefan > > With thingatpt you may specify arbitrary strings as delimiters. Maybe that's an option in context also. Andreas