Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Customized key bindings
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Brentt  
View profile  
 More options Oct 23 2011, 4:53 pm
Newsgroups: comp.emacs
From: Brentt <brenttnew...@gmail.com>
Date: Sun, 23 Oct 2011 13:53:19 -0700 (PDT)
Local: Sun, Oct 23 2011 4:53 pm
Subject: Customized key bindings
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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
des...@verizon.net  
View profile  
 More options Oct 23 2011, 6:00 pm
Newsgroups: comp.emacs
From: des...@verizon.net
Date: Sun, 23 Oct 2011 18:00:35 -0400
Local: Sun, Oct 23 2011 6:00 pm
Subject: Re: Customized key bindings

You want to look up keyboard macros.
Specifically, you want information on creating them and giving the
macros names.

Then you want to look up how to create key bindings.

Then use a key binding to invoke the key board macro by it's name.

Put both the macro and the key binding in your .emacs file.

--
Dan Espen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce Stephens  
View profile  
 More options Oct 23 2011, 6:10 pm
Newsgroups: comp.emacs
From: Bruce Stephens <bruce+use...@cenderis.demon.co.uk>
Date: Sun, 23 Oct 2011 23:10:11 +0100
Local: Sun, Oct 23 2011 6:10 pm
Subject: Re: Customized key bindings

des...@verizon.net writes:
> Brentt <brenttnew...@gmail.com> writes:

[...]

>> 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.

> You want to look up keyboard macros.
> Specifically, you want information on creating them and giving the
> macros names.

Or skeletons, <http://www.emacswiki.org/emacs/SkeletonMode>

[...]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Breitfeld  
View profile  
 More options Oct 24 2011, 4:41 am
Newsgroups: comp.emacs
From: Peter Breitfeld <ph...@t-online.de>
Date: Mon, 24 Oct 2011 10:41:42 +0200
Local: Mon, Oct 24 2011 4:41 am
Subject: Re: Customized key bindings

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joost Kremers  
View profile  
 More options Oct 25 2011, 11:06 am
Newsgroups: comp.emacs
From: Joost Kremers <joostkrem...@yahoo.com>
Date: 25 Oct 2011 15:06:44 GMT
Local: Tues, Oct 25 2011 11:06 am
Subject: Re: Customized key bindings

Brentt wrote:
> e.g. I'd like C-c C-i to enter in an

> \int_{}

> and have the cursor end up in the first bracket.

better to use some sort of snippet or skeleton mode. i use yasnippet myself, but
there are others.

--
Joost Kremers                                      joostkrem...@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Petter Gustad  
View profile  
 More options Oct 27 2011, 6:11 pm
Newsgroups: comp.emacs
From: Petter Gustad <newsmailco...@gustad.com>
Date: Fri, 28 Oct 2011 00:11:05 +0200
Local: Thurs, Oct 27 2011 6:11 pm
Subject: Re: Customized key bindings

You can write elisp as described by Peter Breitfeld. However, if
you're not completely ready for elisp yet you can write keyboard
macros. Try to type this

C-x ( \ i n t _ { } C-b C-x )
C-e

The C-e will play back your keyboard macro. Or you can bind it to a
key, like F8:

C-x C-k b F8

Then you can play back your keyboard macro using F8.

Or you can give it a name

C-x C-k n latex-int

Which you can execute with M-x latex-int

Or save using

M-x insert-kbd-macro <RET> latex-int <RET>

The above will generate:

(fset 'latex-int
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ("\\int_{}^B 0 "%d")) arg)))

Which you can put in your .emacs for later use.

//Petter
--
.sig removed by request.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »