From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: sandipchitale@yahoo.com (Sandip Chitale) Newsgroups: gmane.emacs.help Subject: Re: how to close braces in all modes automatically? Date: 6 Nov 2003 09:48:35 -0800 Organization: http://groups.google.com Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1068142493 3484 80.91.224.253 (6 Nov 2003 18:14:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 6 Nov 2003 18:14:53 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 06 19:14:47 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AHoec-0006QE-02 for ; Thu, 06 Nov 2003 19:14:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AHoXy-00006L-JZ for geh-help-gnu-emacs@m.gmane.org; Thu, 06 Nov 2003 13:07:54 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-NNTP-Posting-Host: 208.135.53.4 Original-X-Trace: posting.google.com 1068140916 31431 127.0.0.1 (6 Nov 2003 17:48:36 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 6 Nov 2003 17:48:36 +0000 (UTC) Original-Xref: shelby.stanford.edu gnu.emacs.help:117925 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13864 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13864 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 wrote in message news:... > 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