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

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

Re: PROPOSAL: Repurpose one key and reserve it for third-party packages


From: Gregory Heytings
Subject: Re: PROPOSAL: Repurpose one key and reserve it for third-party packages
Date: Sat, 13 Feb 2021 13:06:55 +0000


But that would be forbidden by the guideline "Don't define 'C-c LETTER' as a key in Lisp programs", wouldn't it?

It seems to me that this is a matter of "in the word of the law" or "in the spirit of the law". I understand the "spirit" of the guideline to be saying that external code shouldn't try to bind keys that are reserved for the users to decide what to bind. This is not because they are external, but because they would make a decision for the user.


Indeed, my understanding of the "spirit of the law" is different: my understanding is that no code in a library should bind C-c LETTER key, conditionally or not, and that these keys are strictly reserved for users, who have to explicitly bind them in their init file.

AFAIU, this is also how the author of Magit understands that guideline: Magit binds three keys globally unless magit-define-global-key-bindings, whose default value is t, has been set to nil, and only recommends in the docstring to bind "C-c g". With your understanding of the guideline, Magit could have added a third possible to magit-define-global-key-bindings, say 'best, with which the "C-c g" binding would have been created automatically.

Anyway, that question is, as I said, unrelated to the proposal itself.

(defcustom foobar-global-key "" "Foobar global key in C-c")
...
(if (length foobar-global-key)
  (global-set-key (kbd (concat "C-c " foobar-global-key) 'foobar-foo-command)))

This would be defined unconditionally too


Whoops, I wrote too fast indeed, of course it should have been (if (> (length foobar-global-key) 0)..., or perhaps (unless (string-empty-p foobar-global-key)...



reply via email to

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