From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Patrick Drechsler Newsgroups: gmane.emacs.help Subject: how to close braces in all modes automatically? Date: Thu, 06 Nov 2003 00:11:37 +0100 Organization: Dept. of Zoology 2, Biocenter, University of Wuerzburg, Germany Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1068112882 24670 80.91.224.253 (6 Nov 2003 10:01:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 6 Nov 2003 10:01:22 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 06 11:01:20 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 1AHgx5-00079H-00 for ; Thu, 06 Nov 2003 11:01:20 +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 1AHgwd-0000Vn-40 for geh-help-gnu-emacs@m.gmane.org; Thu, 06 Nov 2003 05:00:51 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!skynet.be!skynet.be!fu-berlin.de!uni-berlin.de!wzod41.biozentrum.uni-wuerzburg.DE!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-NNTP-Posting-Host: wzod41.biozentrum.uni-wuerzburg.de (132.187.76.141) Original-X-Trace: news.uni-berlin.de 1068111936 47268207 132.187.76.141 (16 [166469]) User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:gipFbv7Vfr2s1R7BJCm1heH+XKo= Original-Xref: shelby.stanford.edu gnu.emacs.help:117909 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:13848 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13848 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 -- "If anyone tells me to work smarter, not harder, I will kick him or her, hard, in a random body part. I will then kick him or her a second time, "smarter, not harder," which is to say that on the second strike, I'll use the same force, but target more carefully. " -- Catherine