unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to close braces in all modes automatically?
@ 2003-11-05 23:11 Patrick Drechsler
  2003-11-06 10:03 ` Yongtao Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Patrick Drechsler @ 2003-11-05 23:11 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-11-07  8:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-05 23:11 how to close braces in all modes automatically? Patrick Drechsler
2003-11-06 10:03 ` Yongtao Yang
2003-11-06 12:06   ` Patrick Drechsler
2003-11-06 12:41     ` Yongtao Yang
2003-11-06 12:46 ` Jiri Pejchal
2003-11-06 14:49   ` Patrick Drechsler
2003-11-06 17:48 ` Sandip Chitale
2003-11-07  8:01   ` Patrick Drechsler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).