Message from discussion
Customized key bindings
Received: by 10.68.22.230 with SMTP id h6mr22989173pbf.4.1319445703346;
Mon, 24 Oct 2011 01:41:43 -0700 (PDT)
Path: c1ni6846pbr.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!news.albasani.net!.POSTED!not-for-mail
From: Peter Breitfeld <ph...@t-online.de>
Newsgroups: comp.emacs
Subject: Re: Customized key bindings
Date: Mon, 24 Oct 2011 10:41:42 +0200
Organization: SFZ Bad Saulgau
Lines: 36
Message-ID: <m2lisardbt.fsf@t-online.de>
References: <85e41ea1-ce2a-4cb5-bbad-c36c1e95d4d6@s35g2000pra.googlegroups.com>
Mime-Version: 1.0
X-Trace: news.albasani.net wAa3izyFJwt5+SAaXl6c3zKi65WPalJZPpsBEYK0YGOotalGQlOjmBkQ9CCuMvxxl+6Thb0uKSAVFmyY01urbg==
NNTP-Posting-Date: Mon, 24 Oct 2011 08:41:42 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="CCpVgwKri5lCI594tocMNiZr771AxLnc69l6Ryfa+yEQBX9HVF1dvw14d8zopzzERYUg9nw/QXv3nyLzs3j9ViDp8fA7PvZVo7YLzlVYtTAXHEGg4yLTX+uspwfInDr2"; mail-complaints-to="ab...@albasani.net"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin)
X-Face: 0oUHndg#lM=h3scQ/auGM,*9Ms##8Cx6.v5Q@Rke]I)+P[L0+<#3bUG<~qT<hM#r*&H$Z-=
Vw.5cJs3\@i-43`FvXatg%0#e>OV}oH7E5~$4$]p{X/?_ItV{#gq~ZQZa';@MM6B7<;mNBA~VWp$w'
NXr]J
Cancel-Lock: sha1:MUNnWmUBQohaH4oLpenpo/2RdQE= sha1:qPEMMrYGQk2xKruDUQOAc3ZC8gg=
Content-Type: text/plain; charset=us-ascii
Brentt wrote:
> Hello, I use emacs to edit latex documents.
>
> I would like to have some key bindings that will insert my commonly
> used codes.
>
> e.g. I'd like C-c C-i to enter in an
>
> \int_{}
>
> and have the cursor end up in the first bracket.
>
> How does one go about this? I've been searching for documentation on
> custom key bindings, but havn't found anything that spells out how to
> do this. I'm guessing it would have to do with writing an init file,
> but not sure of the code to do this.
I use for these purposes in my .emacs:
(defun my-insert-int ()
"insert int{} in LaTeX buffer"
(interactive)
(insert "\\int_{}")
(goto-char (forward-point -1)))
(add-hook 'LaTeX-mode-hook
(function (lambda ()
(local-set-key (kbd "C-c C-i") 'my-insert-int)
))
)
--
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de