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

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

Re: create new key prefix


From: ken
Subject: Re: create new key prefix
Date: Wed, 20 Feb 2013 04:35:08 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130110 Thunderbird/10.0.12

On 02/19/2013 08:41 PM Tim Visher wrote:
On Tue, Feb 19, 2013 at 8:36 PM, ken<address@hidden>  wrote:
On 02/19/2013 08:20 PM Tim Visher wrote:
On Tue, Feb 19, 2013 at 6:26 PM, ken<address@hidden>   wrote:

I've defined quite a few new keys over the years and so would like to
create
a new key prefix.  I.e., I want to be able to define keys such as "C-c p
s",
"C-c p m", etc.  So how do I tell emacs that (for all possible modes) I
want
"C-c p" to look for the new key definitions.

  From what I've read so far, how this is done depends a lot on the
particular
emacs version.  Mine's 22.1.1.


`(global-set-key (kbd "C-c p m") 'func-name)` doesn't work for you?
The caveat to that is that modes down the line can possible shadow the
binding. But that's easy enough to solve with `(eval-after-load…`
forms.

Thanks much for the reply.  I have almost no idea what you said, but it got
me to try the code which I already wrote (which I didn't do before because I
didn't think it would work, thought sure there was something missing).  The
code I already wrote and left sitting there untested for a couple-three
hours... it works!!

Well that's a completely new experience for me.  B^D

LOL. Good to know.

As an aside, what are you confused about regarding what I said? Maybe
I can help clear some things up for you?

What I read in several docs on the web implied that a command was needed first to create a sparse map (i.e., define-prefix-command) and then to assign it to a key prefix, in my case, "C-c p". So when you wrote/asked, "`(global-set-key... doesn't work for you?", it didn't compute with me at all at first because it seemed like you were ignoring/forgetting all that. But then 1% of me thought, maybe this guy is one of the 0.02% who knows what he's talking about, prompting me to try running my own code (which was likewise ignoring/forgoing sparse map creation etc.). My crap not only ran without error, but it also worked perfectly!

The other part is the reference to "(eval-after-load..."; from your context I gather that it's meant to remedy some other code stepping on my keybindings (and perhaps too other definitions). But how, when, and where to actually implement that function gribbles the laft whicher bonkhaft.




reply via email to

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