From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: Strings as opening/closing delimiters in the syntax table? Date: Wed, 27 Oct 2010 17:38:06 +1100 Organization: Unlimited download news at news.astraweb.com Message-ID: <87aam0nnsh.fsf@rapttech.com.au> References: <573afe15-f5c3-4ed9-8d30-1d0775e20aa7@f33g2000yqh.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1291888673 20750 80.91.229.12 (9 Dec 2010 09:57:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 09:57:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 10:57:50 2010 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.69) (envelope-from ) id 1PQdG1-0001FK-7T for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 10:57:49 +0100 Original-Received: from localhost ([127.0.0.1]:41251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQdFz-0006Zk-JZ for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 04:57:47 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.glorb.com!news.astraweb.com!border1.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:VnmR9QRiLQB3Lm40EJuQ8xSTJos= Original-Lines: 29 Original-NNTP-Posting-Host: 4017b570.news.astraweb.com Original-X-Trace: DXC=`; n0CJ3V^?kW3CAkl5c@Xgk>:JD80HH:B 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:76939 Archived-At: Philip writes: > I want to make emacs match "if" to "then" in sh mode like it does "(" > and ")" in other modes. I read the wiki page about syntax tables > (http://www.emacswiki.org/emacs/EmacsSyntaxTable ) but it only talks > about opening and closing delimiter *characters*. Have I > misunderstood, or have I found something that emacs cannot do? [ghasp!] There is nothing emacs cannot do! However, I'm not clear exactly what you want. When you say you want emacs to match if to then in sh mode, do you mean work like match-paren does i.e. show the match and maybe highlight if you have a then without a matching then etc or do you mean you want more 'electric' behavior so that when you type if, emacs automatically puts in 'then' and leaves you at a pint where you can enter the condition or are you talking about some sort of indentation which lines up if and then statements or ....? For all of the above, you will likely need to write some elisp functions to add into the mode via one of its hooks. The syntax table is not what you need as this deals primarily with character level syntax. You may be able to do what you want with abbrev mode or possibly by modifying how sh mode does indenting. More information is really needed that describes the behvior you want. Tim -- tcross (at) rapttech dot com dot au