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

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

Remapping keys and creating my own keymap \\ too complicated\\


From: Tatsu Takamaro
Subject: Remapping keys and creating my own keymap \\ too complicated\\
Date: Tue, 3 Dec 2024 19:59:44 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

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 via email to

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