unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tatsu Takamaro <tatsu.takamaro@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Remapping keys and creating my own keymap \\ too complicated\\
Date: Tue, 3 Dec 2024 19:59:44 +0300	[thread overview]
Message-ID: <f20b0907-89b0-e19e-b2c7-b64b592d526e@gmail.com> (raw)

Good afternoon, I'm trying to reassign keys but have run into a number 
of difficulties and questions about the best way to do it and how to do 
it correctly.
1. Do I understand correctly that if I want to change hotkeys, the most 
logical, sensible and ‘beautiful’ way to do it is to create my own key 
map? That is, I create key mappings to commands, save it all in a file, 
and then just plug that map in instead of the default one (via the 
appropriate command in the ‘.emacs’ file). This seems like a more proper 
way, better than making changes to the default key map. Right?

2. Your original manual has a lot of complicated text on this topic. I 
honestly tried to figure it out on my own, though. However, I eventually 
found an article that explains in simple words how to do it. Here is 
that article: 
https://emacspal.com/extending-emacs-functionally-with-user-defined-keymaps/
However, I saw a large number of differences between the article and 
your official documentation. I already wrote to Emacs Pal (the authors 
of the article), but they haven't replied for a week now. On the one 
hand, the article is clear, but the syntax of the commands does not 
match your documentation on many points.

For example, here they describe the define-keymap command:
*
**(define-keymap my-map**
**  "Binding description."**
**  :bind (("C-c C-a" . select-all)**
**         ("C-c C-f" . find-file)))*

And here's an example from the official docs:
*
**         (define-keymap :full t**
**  "g" #'eww-reload**
**  :menu '("Eww"**
**          ["Exit" quit-window t]**
**          ["Reload" eww-reload t]))*

Huge difference. For example: 1) you don't specify the name of the 
keymap right after define-keymap. How do you plan to call it later, if 
not by name? And Emacs itself does not provide the name of the map in 
the command description either. 2) they probably have a description 
after the map name (line ‘Binding description.’), but official syntax 
does not provide any description in this place. 3) further they have the 
:bind key, which is also not officially provided. And other things, as 
you can see from the examples.
Thus, I am even more confused.

3. So how do I create my key map correctly (in simple words)? I need a 
global map to replace the default one. But I don't want to prescribe all 
combinations at all, but only those that I want to set my own. The rest 
of the combinations should remain as in the default one.


             reply	other threads:[~2024-12-03 16:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 16:59 Tatsu Takamaro [this message]
2024-12-04  7:43 ` Remapping keys and creating my own keymap \\ too complicated\\ Jean Louis
2024-12-04 15:49   ` Tatsu Takamaro
2024-12-04 15:55   ` Tatsu Takamaro
2024-12-04 16:06     ` Robert Pluim
2024-12-04 16:37       ` Tatsu Takamaro
2024-12-04 16:40         ` Robert Pluim
2024-12-04 17:05           ` Tatsu Takamaro
2024-12-05 10:25             ` Robert Pluim
2024-12-05 18:08               ` Tatsu Takamaro
2024-12-06  9:57                 ` Robert Pluim
2024-12-06 10:38                   ` Jean Louis
2024-12-06 13:18                     ` Robert Pluim
2024-12-08 16:16                       ` Tatsu Takamaro
2024-12-08 23:07                         ` Stephen Berman
2024-12-09 22:34                           ` Tatsu Takamaro
2024-12-04 16:25 ` Jean Louis
2024-12-04 16:57   ` Tatsu Takamaro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f20b0907-89b0-e19e-b2c7-b64b592d526e@gmail.com \
    --to=tatsu.takamaro@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).