alchemist.el icon indicating copy to clipboard operation
alchemist.el copied to clipboard

"C-c a" isn't a permissible keybinding for minor modes

Open purcell opened this issue 8 years ago • 15 comments

The keybinding conventions describe which keybindings are legal for minor modes, and C-c a isn't among them -- it's one of relatively few bindings reserved for end-user customisation.

I'd strongly encourage you to change this default, and perhaps simply make it easy for users to bind your keymap to C-c a if that's what they want.

Other people are looking at modes like this and concluding that similar bindings are okay, but we should really all be trying to promote the conventions, because they're designed to give everyone a consistent and unsurprising experience.

purcell avatar May 05 '16 10:05 purcell

/cc @bbatsov, because this applies equally to projectile and projectile-rails.

purcell avatar May 05 '16 10:05 purcell

Hi @purcell

Many thanks pointing this out to me. I'll start thinking about a good keybinding solution instead of C-c a.

If you have some recommendations or ideas, I'm open for any suggestion. 👍

tonini avatar May 12 '16 10:05 tonini

C-c ', C-c ; etc. are options. No specific recommendations, sorry. :-)

purcell avatar May 13 '16 06:05 purcell

I came here to mention this, though my reference is different :)

Trevoke avatar Jun 24 '16 15:06 Trevoke

Please do not use C-c ', it is used in org-src-mode to save current buffer content into the master file and then close and kill the buffer.

C-c C-a seems to be available though, but is reserved for major-modes (which is C-c ; as well).

I do think it had been better if the emacs team had said C-u is reserved for user stuff, but they did not and we have to live with a very nasty small set of keys to use.

NobbZ avatar Aug 14 '16 13:08 NobbZ

To be fair, the emacs conventions only specify that packages can't SET those keys, but there's nothing wrong with alchemist showing a list of these exact keybindings in the readme and then letting users CHOOSE whether or not to change them.

The only thing that you can't do as a package is set these bindings FOR the user.

Trevoke avatar Aug 14 '16 13:08 Trevoke

There are many suggestions which prefix we should use in the future as default for the alchemist minor mode.

Currently I'm thinking about C-c \

What's your opinion on this one guys?

tonini avatar Aug 15 '16 12:08 tonini

On standard American keyboards, \ is a bit out of the way on the right side, so unless the next keys are on the left, it might be a little annoying to use.

This being said, I don't think it would be a great hindrance, and like all other things, we'll get used to it (or rebind it ourselves to something else, of course)

Trevoke avatar Aug 15 '16 13:08 Trevoke

Do we strictly need a default keybinding? Maybe we can ask users to set it up in the "Installation" section of the README.

whatyouhide avatar Aug 15 '16 13:08 whatyouhide

@whatyouhide I guess we need a default keybinding to provide a base level of usability.

That said, I am no usability expert.

gausby avatar Aug 15 '16 14:08 gausby

The alchemist documentation is already quite readable, and the quickstart is very quick. I know this kind of thinking is a potental slippery slope, but I don't see the cost of adding a paragraph that says:

If you just want to get started, here's some keybindings for you, just copy and paste into your emacs config: [...]

Trevoke avatar Aug 15 '16 14:08 Trevoke

I am using a standard american keyboard, and I don't think \ C-c \ is that hard to type, though you would need two hands, and the right hand would leave the home row. I know this would be horrible to type on a danish layout (and perhaps other scandinavian keyboard) as backslash require two modifier keys to type (alt+shift+7, as far as I recall).

C-c ; is easy on an american keyboard as ";" doesn't need modifier keys and is on the home row, but it would need one modifier key (shift) on a danish keyboard.

C-c ; would be my preferred default binding, and I still think that there should be a default binding. I think it is better to “enforce” a default binding than not to have one—the package would feel broken to some people if we didn't include one: some people might skip the documentation and just hunt for a cheatsheet.

gausby avatar Aug 16 '16 09:08 gausby

I still agree with @Trevoke :)

whatyouhide avatar Aug 16 '16 09:08 whatyouhide

@whatyouhide that is okay. I just tried to bring some justifications and do some reasoning.

This would be the first Emacs package I've encountered that didn't provide default bindings, if we choose to remove them.

gausby avatar Aug 16 '16 09:08 gausby

Just like you, I'm trying to bring up a different argument as well. I've used a number of packages that didn't provide default keybindings, though it's true that by and large, they are provided for us.

At this point my expectation for not having a default keybinding has a triple purpose:

  • one is that it's a very simple way for the package to follow the emacs conventions.
  • two is that I can go back to my config file to find the keybindings, not have to wonder where the maintainer put them.
  • three is that I don't have to wonder if a package is going to trample some of my custom keybindings because I'm using keybindings which I think are reserved for my own personal use.

Here are the packages that I'm still using (with the exception of Helm though I'm sure I'll go back to it someday) that didn't provide a default keybinding.

  • magit ( https://github.com/magit/magit )
  • smex ( https://github.com/nonsequitur/smex )
  • origami ( https://github.com/gregsexton/origami.el )
  • anzu ( https://github.com/syohex/emacs-anzu )
  • expand-region ( https://github.com/magnars/expand-region.el )
  • sqlup ( https://github.com/Trevoke/sqlup-mode.el )
  • default-text-scale ( https://github.com/purcell/default-text-scale )
  • helm ( https://github.com/emacs-helm/helm ) (kinda arguable, so at the bottom)

All this having been said, I prefer no default keybindings over a default keybinding, and I prefer C-c ; over C-c \, because it works on Azerty and Qwerty keyboards.

Trevoke avatar Aug 16 '16 12:08 Trevoke