help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strings as opening/closing delimiters in the syntax table?


From: Tim X
Subject: Re: Strings as opening/closing delimiters in the syntax table?
Date: Wed, 08 Dec 2010 15:33:35 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Philip <phil.ganchev@gmail.com> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]