all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Creating custom key maps for stock bindings
@ 2020-01-21  0:16 Tim Johnson
  2020-01-21  1:10 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Johnson @ 2020-01-21  0:16 UTC (permalink / raw)
  To: MLEmacs

Using GNU Emacs 26.1 with evil and which-key

which-key provides the following function:

(which-key--create-buffer-and-show &optional PREFIX-KEYS FROM-KEYMAP
FILTER PREFIX-TITLE)

I use something like this:

(which-key--create-buffer-and-show nil tj-mode-map)

which I really like because it provides more-than-mnemonic help in a 
buffer, on demand and enables me to organize keybindings to any number 
of keymaps presumable by functionality.

So, having been raised on a homestead and an eternal tinkerer, it occurs 
to me that I could rebind existing

singleton modifier key into something like this (simple examples only):

tj-control-keymap, containing all the commands which have a control-char 
combinations

tj-alt-keymap, containing all the commands which have a alt-char 
combinations

tj-control-alt-keymap, containing all the commands which have a 
control-alt-char combinations

The question I have, to avoid possible unforeseen problems down the 
road, do I need to unset all of these keys before rebinding them to 
custom keymaps?

I believe most are bound to global-map.

thanks

-- 
Tim
tj49.com




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Creating custom key maps for stock bindings
  2020-01-21  0:16 Creating custom key maps for stock bindings Tim Johnson
@ 2020-01-21  1:10 ` Drew Adams
  2020-01-21  1:22   ` Tim Johnson
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2020-01-21  1:10 UTC (permalink / raw)
  To: Tim Johnson, MLEmacs

> it occurs to me that I could rebind existing 
> singleton modifier key into something like this
> (simple examples only):
> 
> tj-control-keymap, containing all the commands which have a control-
> char combinations
> 
> tj-alt-keymap, containing all the commands which have a alt-char
> combinations
> 
> tj-control-alt-keymap, containing all the commands which have a
> control-alt-char combinations
> 
> The question I have, to avoid possible unforeseen problems down the
> road, do I need to unset all of these keys before rebinding them to
> custom keymaps?

A modifier key is not, by itself, a key sequence.
So you can't bind, say, `C-' to `tj-control-keymap'.

But you can certainly bind each of the maps you mention
to a real key sequence, which could be a single key
(other than a modifier key).

And in that case, no, you don't need to unset any
existing key bindings.  (Of course, if the key you
bind one of those maps to is already bound to some
command or another keymap then it will no longer
be available for that original binding, if you
rebind it.)

See, for example, the value of variable `ctl-x-map',
which is bound to all of the key sequences that start
with `C-x'.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Creating custom key maps for stock bindings
  2020-01-21  1:10 ` Drew Adams
@ 2020-01-21  1:22   ` Tim Johnson
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Johnson @ 2020-01-21  1:22 UTC (permalink / raw)
  To: Drew Adams, MLEmacs


On 1/20/20 4:10 PM, Drew Adams wrote:
>> it occurs to me that I could rebind existing
>> singleton modifier key into something like this
>> (simple examples only):
>>
>> tj-control-keymap, containing all the commands which have a control-
>> char combinations
>>
>> tj-alt-keymap, containing all the commands which have a alt-char
>> combinations
>>
>> tj-control-alt-keymap, containing all the commands which have a
>> control-alt-char combinations
>>
>> The question I have, to avoid possible unforeseen problems down the
>> road, do I need to unset all of these keys before rebinding them to
>> custom keymaps?
> A modifier key is not, by itself, a key sequence.
> So you can't bind, say, `C-' to `tj-control-keymap'.
Understood about the modifiers.
> But you can certainly bind each of the maps you mention
> to a real key sequence, which could be a single key
> (other than a modifier key).
Good.
> And in that case, no, you don't need to unset any
> existing key bindings.  (Of course, if the key you
> bind one of those maps to is already bound to some
> command or another keymap then it will no longer
> be available for that original binding, if you
Cool.
> rebind it.)
>
> See, for example, the value of variable `ctl-x-map',
> which is bound to all of the key sequences that start
> with `C-x'.

I see no utility in rebinding such sequences. With which-key, pressing 
c-x and waiting a couple of seconds invokes a buffer with descriptions 
of all sequences starting with c-x.

I just want to list out for sequences with simpler modifiers, C-char, 
C-M-char, M-char, Super-char and hyper-char.

Looks good to go.

Thanks Drew

-- 
Tim
tj49.com




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-21  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-21  0:16 Creating custom key maps for stock bindings Tim Johnson
2020-01-21  1:10 ` Drew Adams
2020-01-21  1:22   ` Tim Johnson

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.