help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keybinding help


From: Kevin Rodgers
Subject: Re: keybinding help
Date: Mon, 15 May 2006 17:39:41 -0600
User-agent: Thunderbird 1.5.0.2 (Windows/20060308)

Ryan Krauss wrote:
> I had read that section.  The thing that was keeping me from getting
> what I wanted was the combination of keybindings with lambda functions
> (which I didn't know existed in Lisp - or how to write them).
>
> In the versions that I looked at, there was no simple example of
> writing a key binding to insert text.

What you are calling a lambda function is actually an anonymous
function.  But strictly speaking, a Lisp function (anonymous or not) is
not necessary for this.

Assuming that all you need to do to insert "\lstinline!" is to type
those 10 characters literally, this is how you would define a keyboard
macro to do that:

C-x ( \lstinline! C-x )

Now `C-x e' will insert "\lstinline!".  You might next want to name that
macro and bind it to `C-c l':

M-x name-last-kbd-macro RET insert-lstinline RET
M-x global-set-key RET C-c l insert-lstinline RET

See the "Naming and Saving Keyboard Macros" section of the manual for
more details.  Or you could short circuit all of those commands and just
put this in your .emacs file:

(global-set-key "\C-cl" "\\lstinline!")

--
Kevin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]