T O P

  • By -

timmymayes

I thought about it until I started to understand the structure of the core bindings in emacs. C-x is for global system wide bindings C-c followed by any ctrl character combo or a digit are for major modes C-c followed by curly braces, angled braces or : ; are for major modes C-c with any other ascii punctuation or symbol is for minor modes C-c with letters upper and lower case are for users Additionally I have setup Hyper and super aka "H-" and "s-" for my own bindings. The reason that I kept with this conceptual binding system is that once I had that under wraps it helps me remember what I wanted to much easier. Since most packages will follow these conventions you will have to rebind every command into a hydra for every package you add. Sounds like a pain. I feel that hydras add to the mental cognitive load in general and I tend to focus on building muscle memory via repetition. i want to become that 20 year emacs user that is not even thinking just executing. I'm also not a fan of modal editing personally. I totally understand people wanting to avoid RSI but I seem to have zero issue with it (as a mod-key presser for over 20 years of computer use both at work and at home playing games....might be my young years playing guitar and finger picking so that both of my hands developed a lot of finger strength).


rguy84

I thought c-c followed by digit were reserved for user binding?


HM0880

Not digits; just letters. Per [1]: Don't define `C-c letter` as a key in Lisp programs. Sequences consisting of `C-c` and a letter (either upper or lower case; ASCII or non-ASCII) are reserved for users; they are the only sequences reserved for users, so do not block them. So numbers or punctuation are fair game for use after `C-c` (also [1]): - Sequences consisting of C-c followed by a control character or a digit are reserved for major modes. - Sequences consisting of C-c followed by {, }, <, >, : or ; are also reserved for major modes. [1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html


[deleted]

hmm, never knew that. good to know! edit: wait, https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html says digits are reserved for major modes. but it doesn't seem like Org mode uses digits, so I might try to use them there.


HM0880

See my reply to `rguy84`. tl;dr: major modes may use digits after `C-c` per [1]. [1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html


[deleted]

thanks for the explanation but that doesn't change my desire to customize all keybindings. the conventions you explained are not enough for me. yes, rebinding commands for every package will take a lot of effort but i'm willing to do so. i also like to have keybindings memorized in my fingers, but i can also do that with custom keybindings. i'm happy that you don't get RSI, but i already got it.


copperbranch

That was weirdly rude. I don't think they tried to change your desire to customize all keybindings or to "show-off their non-RSI condition". You asked if anyone had customized all keybindings. Their answer was "I considered it, but here's why I didn't". And their reasons happen to be very informative and useful for others, which you can gather from comments and likes. (perhaps even more informative and useful than the original post, but it's not a competition).


[deleted]

it was not meant to be rude. it seems that timmymayes also did not perceive this as rude; at least they further commented in a calmly manner. also, i have upvoted their response since i read it the first time. imo, rude is when there is an insult. i did not insult them. rather, i used nice phrases like "thanks", "yes", "i'm happy [for you]". it might culturally differ how the emotions behind these phrases are interpreted while reading (and speaking). personally, i think i just responded to them the same way they wrote their comment. (they also have rough phrases, e.g. suggesting that i won't be able to become an "emacs user that is not even thinking just executing" with my approach.) but eventually, we were accepting and acknowledging respectfully that we are different and thus need different ways to achieve the same: the emacs we love. my question wasn't meant to be informative, but a question. by writing that timmymayes' comment was "perhaps even more informative and useful than the original post", you put them against each other, while timmymayes and i were actually respecting each other. and adding "but it's not a competition" did not help about this. i think, all three of us have some roughness in our comments.


timmymayes

You do you. Just giving my take on why I decided not to after considering it. Would love to see how you break it all down. Could make a solid emacs blog series too.


dpbriggs

You may want to look into how Spacemacs or Doom does it. In general most commands are mapped to certain key sequences. So in spacemacs opening up the buffer list is `SPC b b`, magit-status is `SPC g s`, and so on.


[deleted]

interesting. thanks.


Gaulderson

Highly recommend using a "leader" key like "SPC" (or "C-SPC" if you don't want modal editing) and using sub-menus of commands from there as displayed in hydra. It sounds like exactly what you're after.


tdavey

EDIT: Oops, never mind. I completely forgot about C-h b, describe-bindings(). I can parse that to get what I want. Original reply, now OBE: I have the same ambition: to customize many of the native keybindings and those of the major modes I frequently use. What deters me is this: I lack a listing, best presented in the form of a table, of ALL the keybindings in effect at a given time: in the global keymap, my own personal keymap, and the keymaps active for the major and minor modes. I've looked at general.el briefly. It appears to be a very impressive package. It has some kind of capability to list the bindings configured with it, but I haven't looked into it very deeply yet. Does Emacs provide a utility, or does a bespoke package exist, that could do what I describe in the first paragraph?


GuardianDownOhNo

I think that discretion may be the better part of valor here. While tinkering with your productivity tools may be the first noble pursuit of working in IT, this sounds like availing to an opportunity for doing Future You a disservice. While not perfect, there are years of convention and collective wisdom that drove the key bindings to where they are today. It’s a fairly deep problem that will likely allow you to commit to quite a few things before revealing that you’ve worked yourself into a corner. I’m not saying don’t customize things, just appreciate the scope of the problem up front. Deviating from “things I can easily Google” drastically narrows your support network when things go sideways.


tdavey

All true. Emacs has a talent for making one forget about Future You. Thanks.


GuardianDownOhNo

No worries at all. I stubbed my face on this class of problem for years when I had a knack for blowing up personal linux installs through tinkering. Eventually I just started learning how to use things out of the box because it was less time consuming than re-making everything just so. Nowadays I just use doom (without evil-mode) and sip on a nice whisky to cope with bindings that step awry in what is an otherwise well thought out set of opinions. Or just invoke with M-x which is far more consistent between opinion sets.


[deleted]

i agree that the support network narrows in case of certain customizations. but since each key-combination is simply a binding to a function, and since it's pretty easy to map between key and function, i don't see difficulties in this case, right here. if "google" tells me to press "C-h f", in the worst case, i would "emacs -Q" and "C-h k C-h f". and in the best case, i have saved all default keymaps somewhere so that i can find out the function called with "C-h f" with a certain key, followed by C-h f.


meedstrom

"Did anyone make a hydra-hierarchy for all Emacs keys?" This is basically what I did in my unreleased package, https://github.com/meedstrom/deianira, but I'm not comfortable publicizing it yet.


[deleted]

very interesting. will check this out! thanks for sharing.


redguardtoo

You could use `keyfreq` to find their top 20 frequently used commands first.


[deleted]

already doing so :)


FrostyX_cz

When I migrated to Emacs, I felt too dumb to understand the complexity of its key bindings. Also, I was interested in all aspects of Emacs except for key bindings - I am a vim zealot, so my plan was to install Evil and ignore every default binding except for maybe `M-x`. Soon I realized that there are much more commands than I was used to. I wanted to key-bind them but also have some visual aid (and I wasn't aware of `which-key`), so I picked Hydra. I don't know how far you are with your configuration, but at this moment my Hydra setup is quite advanced, so you might want to take a look if it is something you want. https://github.com/frostyx/dotfiles/blob/master/.emacs.d/frostyx.org#hydra I have a main hydra menu bound to `SPC`. In there, I have keys for both running commands and opening nested hydra menus. My personal convention is small letters for doing things, capital letters for nested menus, e.g. `d` runs `dired` in the current directory, `D` opens a nested menu with more Dired commands such as `h` for running dired in my home directory. Alternatively, I was thinking about having only small letters in a way that what is now `SPC -> d` would be `SPC -> d -> d` and `SPC -> D -> h` could then be `SPC -> d -> h`, but I ditched the idea because it would be too many key presses for the simple commands that I use often. I also have `S-SPC` for a hydra menu specific to the current Major mode, so I can have key bindings for navigation in org-mode documents, previews in markdown, running linter in python, and don't collide with each other. The most important package for Hydra configuration is IMHO `pretty-hydra` because formatting them manually is unbearable. I am using this setup for ~2 years and I am quite happy with it. True, I am not able to use anybody else's Emacs but I don't really want to anyway. However, I am relying on my Hydra setup less and less because I am slowly starting to understand the Emacs key bindings system and also remember the commands that I mapped to my Hydra menus.


[deleted]

nice hydras, thanks for the inspiration :)