unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Clarifying the C-c letter guideline
@ 2021-02-14 12:12 Philip Kaludercic
  2021-02-14 17:38 ` Jean Louis
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Philip Kaludercic @ 2021-02-14 12:12 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]


Hi,

a few days ago, there was a discussion on help-gnu-emacs[0],
specifically on this one paragraph from (elisp) Key Binding Conventions:

> • 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.

There seems to be some uncertainty in how this should be
interpreted. Does this mean that...

- No package/library/third-party code may ever bind a command or map to
  C-c LETTER, under any circumstances (in the letter of the law).

- A package/library/third-party code may bind a command or a map to C-c
  LETTER, if the user is explicitly asked and he or she gives
  permission (in the spirit of the law).

I lean towards the second interpretation, which would allow something
like

    (defcustom foobar-bind-to nil
      "Bind command `foobar' to C-c LETTER."
      :set (lambda (sym val)
	     (cond (val (global-set-key (format "%c" val) #'foobar))
		   ((where-is-internal #'foobar)
		    (global-set-key (car (where-is-internal #'foobar)) nil)))
	     (set-default sym val))
      :type '(choice (const :tag "Don't bind" nil)
		     (character :tag "Bind to")))

(even though I don't think code like this is necessary in the first
place, but this is just an example).

The background of this discussion is to settle the question, whether/how
packages might suggest binding a global command, if their interface is
not a major or minor mode, but a specific command
(e.g. magit-status). Using defcustom is probably not the best idea, but
something I think that something along these lines might be interesting
to have.

So I'd be interested in what the mailing list has to say on this
question. Should this section be rephrased to clarify the guideline?

[0] https://lists.gnu.org/archive/html/help-gnu-emacs/2021-02/msg00426.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-15  3:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 12:12 Clarifying the C-c letter guideline Philip Kaludercic
2021-02-14 17:38 ` Jean Louis
2021-02-14 18:14   ` Philip Kaludercic
2021-02-14 18:15 ` Matt Armstrong
2021-02-15  1:35 ` chad
2021-02-15  3:08   ` Matt Armstrong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).