unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: emacs-devel@gnu.org
Subject: Clarifying the C-c letter guideline
Date: Sun, 14 Feb 2021 13:12:52 +0100	[thread overview]
Message-ID: <87ft1y4zln.fsf@posteo.net> (raw)

[-- 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 --]

             reply	other threads:[~2021-02-14 12:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-14 12:12 Philip Kaludercic [this message]
2021-02-14 17:38 ` Clarifying the C-c letter guideline 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ft1y4zln.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).