* create new key prefix
@ 2013-02-19 23:26 ken
2013-02-20 1:20 ` Tim Visher
0 siblings, 1 reply; 6+ messages in thread
From: ken @ 2013-02-19 23:26 UTC (permalink / raw)
To: GNU Emacs List
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.
Thanks
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: create new key prefix
2013-02-19 23:26 create new key prefix ken
@ 2013-02-20 1:20 ` Tim Visher
2013-02-20 1:36 ` ken
0 siblings, 1 reply; 6+ messages in thread
From: Tim Visher @ 2013-02-20 1:20 UTC (permalink / raw)
To: gebser; +Cc: GNU Emacs List
Hi Ken,
On Tue, Feb 19, 2013 at 6:26 PM, ken <gebser@mousecar.com> 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.
--
In Christ,
Timmy V.
http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: create new key prefix
2013-02-20 1:20 ` Tim Visher
@ 2013-02-20 1:36 ` ken
2013-02-20 1:41 ` Tim Visher
0 siblings, 1 reply; 6+ messages in thread
From: ken @ 2013-02-20 1:36 UTC (permalink / raw)
To: Tim Visher; +Cc: GNU Emacs List
On 02/19/2013 08:20 PM Tim Visher wrote:
> Hi Ken,
>
> On Tue, Feb 19, 2013 at 6:26 PM, ken<gebser@mousecar.com> 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.
>
> --
>
> In Christ,
>
> Timmy V.
Timmy,
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: create new key prefix
2013-02-20 1:36 ` ken
@ 2013-02-20 1:41 ` Tim Visher
2013-02-20 9:35 ` ken
0 siblings, 1 reply; 6+ messages in thread
From: Tim Visher @ 2013-02-20 1:41 UTC (permalink / raw)
To: gebser; +Cc: GNU Emacs List
On Tue, Feb 19, 2013 at 8:36 PM, ken <gebser@mousecar.com> wrote:
> On 02/19/2013 08:20 PM Tim Visher wrote:
>> On Tue, Feb 19, 2013 at 6:26 PM, ken<gebser@mousecar.com> 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?
--
In Christ,
Timmy V.
http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: create new key prefix
2013-02-20 1:41 ` Tim Visher
@ 2013-02-20 9:35 ` ken
2013-02-20 17:44 ` Tim Visher
0 siblings, 1 reply; 6+ messages in thread
From: ken @ 2013-02-20 9:35 UTC (permalink / raw)
To: Tim Visher; +Cc: GNU Emacs List
On 02/19/2013 08:41 PM Tim Visher wrote:
> On Tue, Feb 19, 2013 at 8:36 PM, ken<gebser@mousecar.com> wrote:
>> On 02/19/2013 08:20 PM Tim Visher wrote:
>>> On Tue, Feb 19, 2013 at 6:26 PM, ken<gebser@mousecar.com> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: create new key prefix
2013-02-20 9:35 ` ken
@ 2013-02-20 17:44 ` Tim Visher
0 siblings, 0 replies; 6+ messages in thread
From: Tim Visher @ 2013-02-20 17:44 UTC (permalink / raw)
To: gebser; +Cc: GNU Emacs List
On Wed, Feb 20, 2013 at 4:35 AM, ken <gebser@mousecar.com> wrote:
> On 02/19/2013 08:41 PM Tim Visher wrote:
>> On Tue, Feb 19, 2013 at 8:36 PM, ken<gebser@mousecar.com> wrote:
>>> On 02/19/2013 08:20 PM Tim Visher wrote:
>>>> On Tue, Feb 19, 2013 at 6:26 PM, ken<gebser@mousecar.com> 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!
Generally you use sparse maps, etc. when you're defining a keymap for
a mode that you're writing or when you want to activate a group of
keys all at once. In your case you probably aren't intending to do
that.
> 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.
`eval-after-load` is just a way to evaluate a function after a library
is loaded. In other words, if I wanted to have `C-c p p` do something
but `mode-x` defined `C-c p p` to do something else, the easiest way
I've found to step on the mode's definition is to do an
`(eval-after-load 'mode-x '(local-set-key (kbd "C-c p p")
'func-name))`. That will reset they key in that mode back to what you
want it to be.
--
In Christ,
Timmy V.
http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-02-20 17:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-19 23:26 create new key prefix ken
2013-02-20 1:20 ` Tim Visher
2013-02-20 1:36 ` ken
2013-02-20 1:41 ` Tim Visher
2013-02-20 9:35 ` ken
2013-02-20 17:44 ` Tim Visher
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).