[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: |
Philip Kaludercic |
Subject: |
Re: PROPOSAL: Repurpose one key and reserve it for third-party packages |
Date: |
Sat, 13 Feb 2021 10:09:07 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Gregory Heytings <gregory@heytings.org> writes:
>>> To me what you propose looks pretty close to using customize to set
>>> a foobar-set-global-binding variable that would be used in a call
>>> to global-set-key.
>>
>> Yes, that could also be done, the precise code that is generated is
>> an open question
>>
>
> 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.
> (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, I assume you wanted to set
the default value of foobar-global-key to nil and check if it is
non-nil. And even then, the binding should be done in the defcustom's
:set procedure, to make it reversible -- but that's not important here.
> If that's allowed, then why not this?
>
> (defcustom foobar-global-key "z" "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 is not very different from the first one, and does what the
> guideline forbids, but it could be argued that it does not because it
> does so only conditionally...
Conditionally, yes, but also by *default*, which I think is the
problem. The default execution of this code would override whatever was
bound on C-c z, without asking the user -- and I see this as a violation
of guideline's "spirit".
--
Philip K.
signature.asc
Description: PGP signature
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, (continued)
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Philip K., 2021/02/12
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Gregory Heytings, 2021/02/12
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Philip Kaludercic, 2021/02/12
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Gregory Heytings, 2021/02/12
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Philip Kaludercic, 2021/02/12
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Gregory Heytings, 2021/02/12
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Philip Kaludercic, 2021/02/12
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Gregory Heytings, 2021/02/12
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Philip Kaludercic, 2021/02/12
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Gregory Heytings, 2021/02/13
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages,
Philip Kaludercic <=
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Gregory Heytings, 2021/02/13
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Philip Kaludercic, 2021/02/13
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Emanuel Berg, 2021/02/13
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Philip Kaludercic, 2021/02/13
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Gregory Heytings, 2021/02/13
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Jean Louis, 2021/02/13
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Emanuel Berg, 2021/02/13
- Nothing is the list - Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Jean Louis, 2021/02/13
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Philip Kaludercic, 2021/02/13
- Re: PROPOSAL: Repurpose one key and reserve it for third-party packages, Jean Louis, 2021/02/13