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.help Subject: Re: +1 char strings as open-bracket/close-bracket Date: Fri, 26 Jun 2009 08:38:06 +0200 Message-ID: <4A446CCE.1090801@easy-emacs.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1245998179 19424 80.91.229.12 (26 Jun 2009 06:36:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Jun 2009 06:36:19 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Kokor Hekkus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 26 08:36:12 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MK52h-000661-In for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Jun 2009 08:36:11 +0200 Original-Received: from localhost ([127.0.0.1]:59585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MK52g-0007q1-Ol for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Jun 2009 02:36:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MK52H-0007pu-6p for help-gnu-emacs@gnu.org; Fri, 26 Jun 2009 02:35:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MK52C-0007pL-Gu for help-gnu-emacs@gnu.org; Fri, 26 Jun 2009 02:35:44 -0400 Original-Received: from [199.232.76.173] (port=38782 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MK52C-0007pI-AS for help-gnu-emacs@gnu.org; Fri, 26 Jun 2009 02:35:40 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.177]:50509) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MK52B-0006US-Nc for help-gnu-emacs@gnu.org; Fri, 26 Jun 2009 02:35:40 -0400 Original-Received: from [192.168.178.27] (p54BE989B.dip0.t-ipconnect.de [84.190.152.155]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis) id 0ML21M-1MK52A2kLd-000ple; Fri, 26 Jun 2009 08:35:39 +0200 User-Agent: Thunderbird 2.0.0.19 (X11/20081227) In-Reply-To: X-Provags-ID: V01U2FsdGVkX19ix0DJYWNR3KyPQtPkrHoZ6Andx1ffWkdvzBs VvGgx1Y361kp54VpiUZplohlwiTDsMFuHdzSKZ0/1MYgme9j4l oCDANybjYl3KcYu7ochyvdQ25hFHbgey4dPWBTHjGc= X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65540 Archived-At: Kokor Hekkus wrote: > Any way of modifying the syntax table to identify a string of more > than one character as an open-bracket or a close-bracket character. > For instance, you might do: > > (modify-syntax-entry ?^ "($") > (modify-syntax-entry ?$ ")^") > > ...to make ^ and $ match each other (from EmacsWiki). How would I > make the two character strings '#>' and '<#' match in the same way? > AFAIU relying on syntax-tables will fail if constructs are nested. In this case have a look at beg-end.el and thingatpt-utils-base.el at https://code.launchpad.net/s-x-emacs-werkstatt/ There detecting nested comments for example is realised that way: (put 'comment 'beginning-op-at (lambda () (if (string= "" comment-end) (beginning-of-form-base comment-start comment-end (line-beginning-position) t nil t) (beginning-of-form-base comment-end nil t nil t)))) (put 'comment 'end-op-at (lambda () (if (string= "" comment-end) (when (looking-at comment-start) (end-of-line)) (end-of-form-base comment-start comment-end nil t nil t)))) Replace comment-start/end here by your form, write "(put 'MY-Form... " it should work. Afterwards you may define a jump-function similar to match-paren. HTH Andreas > The above doesn't work. > > Thanks! > >