From: Yongtao Yang <yangyongtao@yahoo.com>
Subject: Re: how to close braces in all modes automatically?
Date: 06 Nov 2003 11:03:21 +0100 [thread overview]
Message-ID: <t743cd1ke52.fsf@cempc10.elmagn.chalmers.se> (raw)
In-Reply-To: m3ekwme7h2.fsf@pdrechsler.fqdn.th-h.de
Patrick Drechsler <patrick.drechsler@gmx.net> writes:
> 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.
>
...
>
> Grateful for any help (esp. concerning Matlab),
>
I have the following in my .emacs. Stupid but works. :) You have to
use matlab-mode.el for it to work
====begin=========
(autoload 'matlab-mode "matlab" "Enter Matlab mode." t)
(setq auto-mode-alist (cons '("\\.m$" . matlab-mode) auto-mode-alist))
(defun matlab-electric-semi ()
"Insert a semicolon in matlab mode.
then linefeed and reindent the new line. "
(interactive)
(insert ";")
(matlab-linefeed))
(defun matlab-electric-cont-line ()
"Insert a continue line in matlab mode.
then linefeed and reindent the new line. "
(interactive)
(insert "...")
(matlab-linefeed))
(defun matlab-electric-parenthesis ()
"Insert a pair of parenthesis in matlab mode."
(interactive)
(insert "()")
(backward-char 1))
(defun matlab-electric-bracket ()
"Insert a pair of brackets in matlab mode."
(interactive)
(insert "[]")
(backward-char 1))
(defun matlab-electric-brace ()
"Insert a pair of braces in matlab mode."
(interactive)
(insert "{}")
(backward-char 1))
(defun my-matlab-mode-hook ()
(setq matlab-shell-command-switches '("-nojvm" "-nosplash"))
(setq matlab-function-indent t) ; if you want function bodies indented
(setq fill-column 72) ; where auto-fill should wrap
(setq matlab-indent-level 4)
(setq matlab-shell-input-ring-size 1024)
(setq matlab-shell-history-file "~/.matlab/R13/history.m")
(setq matlab-verify-on-save-flag 'nil)
(turn-on-auto-fill)
(local-set-key ";" 'matlab-electric-semi)
(local-set-key "(" 'matlab-electric-parenthesis)
(local-set-key "[" 'matlab-electric-bracket)
(local-set-key "{" 'matlab-electric-brace)
(local-set-key "\C-\M-m" 'matlab-electric-cont-line)
; (turn-on-setnu-mode)
)
====end=========
--
Yongtao Yang
email: yangyongtao@yahoo.com
next prev parent reply other threads:[~2003-11-06 10:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-05 23:11 how to close braces in all modes automatically? Patrick Drechsler
2003-11-06 10:03 ` Yongtao Yang [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=t743cd1ke52.fsf@cempc10.elmagn.chalmers.se \
--to=yangyongtao@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).