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

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

Re: how to close braces in all modes automatically?


From: Sandip Chitale
Subject: Re: how to close braces in all modes automatically?
Date: 6 Nov 2003 09:48:35 -0800

Check out this thread:

http://groups.google.com/groups?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&edition=us&frame=right&th=163242e8bb30f14d&seekm=b607d812.0302280000.6d4fa1b7%40posting.google.com

The idea is that a matching delimiter insertion is done based on the
syntax-table for the mode.

sandip

Patrick Drechsler <patrick.drechsler@gmx.net> wrote in message 
news:<m3ekwme7h2.fsf@pdrechsler.fqdn.th-h.de>...
> Hi,
> 
> is there a simple way of closing all braces automatically in all
> modes (i.e. HTML, Java, LaTeX, Matlab,...)?
> 
> My Linux (Suse 8.2) came with a snipplet which does this for
> LaTeX-mode but I haven't been able to adopt it for *all* modes.
> 
> --8<------------------------schnipp------------------------->8---
> (defun TeX-Inserting (sta stb stc)
>     (if (= (preceding-char) sta )
>       (insert stb)
>       (progn (insert stc) (backward-char 1))))
> (defun TeX-schweif () (interactive "*") (TeX-Inserting ?\\ "{"  "{}"))
> (defun TeX-rundekl () (interactive "*") (TeX-Inserting ?\\ "("  "()"))
> (defun TeX-eckigek () (interactive "*") (TeX-Inserting ?\\ "["  "[]"))
> (add-hook 'LaTeX-mode-hook
>       '(lambda ()
>        (local-set-key  "{" 'TeX-schweif)
>        (local-set-key  "(" 'TeX-rundekl)
>        (local-set-key  "[" 'TeX-eckigek)
> ))                                    
> --8<------------------------schnapp------------------------->8---
> 
> Replacing the term 'TeX' with my initials and sticking it into my
> ~/.emacs didn't do the trick.
> 
> Grateful for any help (esp. concerning Matlab),
> 
> Patrick


reply via email to

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