lokedhs / gnu-apl-mode

GNU APL mode for Emacs
GNU General Public License v3.0
94 stars 18 forks source link

Ignores keybinding conventions #1

Closed danlei closed 10 years ago

danlei commented 10 years ago

By binding C-c f, C-c k, C-c s, and C-c v, the keybinding conventions are ignored.

Cf. M-: (info "(elisp) Key Binding Conventions") RET:

* 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) are
  reserved for users; they are the *only* sequences reserved for
  users, so do not block them.

Please consider using different keybindings.

Also, thanks for your work, and keep it up! GNU APL without a nice Emacs mode would be much less fun.

lokedhs commented 10 years ago

Thank you very much for your kind words. I'm glad that my work can be used by others than myself. Please let me know if there are any features you would like to see added. I'd be happy to get i ideas on how to further improve the product.

Now for the keybinding. I think you may have been reading old documentation. It did indeed use to be the case that C-c was reserved for user customisation, but after it became evident that most modes still used this prefix for the mode-specific keybindings, this recommendation was changed. Where did you find the text you quoted? I haven't seen that one in quite some time.

Here's the link to the current version of the document you quoted:

http://www.gnu.org/software/emacs/manual/html_node/elisp/Major-Mode-Conventions.html#Major-Mode-Conventions

And this is also interesting:

http://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Keys.html

Regards, Elias

By binding C-c f, C-c k, C-c s, and C-c v, the keybinding conventions are ignored.

Cf. M-: (info "(elisp) Key Binding Conventions") RET:

Please consider using different keybindings.

Also, thanks for your work, and keep it up! GNU APL without a nice Emacs mode would be much less fun.

— Reply to this email directly or view it on GitHubhttps://github.com/lokedhs/gnu-apl-mode/issues/1 .

lokedhs commented 10 years ago

And now when I actually have had time to read the link I sent, I see what you were saying. It's not about the C-c prefix but the C-c prefix followed by letter.

Now, I'd definitely prefer to keep the C-c bindings, since that is still what most third party modes use, but I can add a feature to make changing it to a different prefix much easier (i.e. no need to change all bindings one by one). Do you have a suggestion as to what prefix to use instead?

Regards, Elias On 11 Jan, 2014 12:47 am, "Daniel H. Leidisch" notifications@github.com wrote:

By binding C-c f, C-c k, C-c s, and C-c v, the keybinding conventions are ignored.

Cf. M-: (info "(elisp) Key Binding Conventions") RET:

  • Don't define C-c LETTER' as a key in Lisp programs. Sequences consisting ofC-c' and a letter (either upper or lower case) are reserved for users; they are the only sequences reserved for users, so do not block them.

Please consider using different keybindings.

Also, thanks for your work, and keep it up! GNU APL without a nice Emacs mode would be much less fun.

— Reply to this email directly or view it on GitHubhttps://github.com/lokedhs/gnu-apl-mode/issues/1 .

danlei commented 10 years ago

You're welcome, and I'll let you know when something comes to my mind.

I've never heard about a change of the convention concerning C-c LETTER keybindings, but of course it's possible I just missed it. I quoted the Emacs info file as it pops up in a fairly recent Emacs (24.3.5.1) when typing M-: (info "(elisp) Key Binding Conventions") RET. Even in the first link you mention, it says:

The key sequences bound in a major mode keymap should usually start with C-c,
followed by a control character, a digit, or {, }, <, >, : or ;. The other punctuation
characters are reserved for minor modes, and ordinary letters are reserved for users.

I.e. that C-c followed by non-letter keys are ok for modes to bind, but C-c LETTER is reserved. Section D.2 Key Binding Conventions on that site says the same as my local info file, too. Also, I'm not sure how your second link would contradict that.

I'm in a bit of a hurry at the moment, but after a (very) quick google search, and consulting C-h n, I couldn't find anything on the mailing list where these changes were discussed. (To the contrary, according to the NEWS file a conflicting keybinding was changed as late as 24.3.) Do you maybe have a link to the discussion leading to these changes, or examples where modes distributed with Emacs proper don't respect these conventions?

lokedhs commented 10 years ago

No, I don't remember where I saw the discussion, but it's very likely it merely was about clarifications regarding which keys are acceptable (i.e. non-letter keys).

danlei commented 10 years ago

Sorry, I missed your first reply when answering.

I'd stick with the C-c prefix for the four conflicting bindings, but use the letters in combination with control (e.g. C-c C-v for gnu-apl-edit-variable etc.). Only one of the four, namely C-c C-s for gnu-apl-show-help-for-symbol-point, would collide with the comint-mode keybindings, and for that one, C-c C-h would be available.

That's also what I'd opt for as an alternative if you want to keep the present keybindings, and make it configurable. (Even if comint-write-output was shadowed.) Consider using the convention conforming setting as default. If not for the sake of conformance itself, maybe sometime in the future you'll want your mode to be distributed with Emacs.

lokedhs commented 10 years ago

Ok, I'll make the necessary changes. I'll commit shortly.

danlei commented 10 years ago

Great! Thanks again for your efforts.

lokedhs commented 10 years ago

Updated according to the suggestions from Daniel.