From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.devel Subject: PROPOSAL: Repurpose one key and reserve it for third-party packages Date: Sun, 07 Feb 2021 22:05:50 +0000 Message-ID: <7ef75c33936136eb3a20@heytings.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38318"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Feb 07 23:10:02 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8sFl-0009rA-K7 for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Feb 2021 23:10:01 +0100 Original-Received: from localhost ([::1]:49430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8sFk-00048u-MU for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Feb 2021 17:10:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8sBp-0000ab-Vg for emacs-devel@gnu.org; Sun, 07 Feb 2021 17:05:58 -0500 Original-Received: from heytings.org ([95.142.160.155]:41134) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8sBm-0002zW-Or for emacs-devel@gnu.org; Sun, 07 Feb 2021 17:05:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1612735551; bh=i/l3S2wMV/rT5PWZ0/z+mZIvTmO4NSmx8NEt/Kf9oco=; h=Date:From:To:Subject:Message-ID:From; b=chCyfD0vQgtfCAhRs1qZkcuz9bY2OraQQ9YhNqzQo8y0Fx8z5Z3edbMzSz24Vmwru njczN+c4y5Zcwd8hbzjr8eDve7ZKuGwh9lwSz2bFCkhx4zCteH2huEJzEBSi88eZn5 knZwY0fMyd6M/sRMbQY+cFYjcb9hvc9sy+yPh+Iok6chpxhHTrgJmz+tVxscqjvRhY BxDNEWSZhXrKSMCdNKnQlTmXOJqwudei6EeRGcUXPYjb8b04PWXSB8p2k53X2eQ0xB StXDJT54kq6VHGHPb4tmGxFWlNVTQlmPkgWUUFMD3/gmVk9ifSA67q+32ljlgBNYuI f+mQrMOVnkNDw== Received-SPF: pass client-ip=95.142.160.155; envelope-from=gregory@heytings.org; helo=heytings.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:264140 Archived-At: =Proposal= It is proposed to repurpose one key, and to reserve it in the key binding conventions for third-party packages. The keys that could be reserved for that purpose are: Option 1. C-z, with a single exception: "C-z C-z" would be bound to "suspend-frame" Option 2. C-z and M-z, with two exceptions: "C-z C-z" would be bound to "suspend-frame", and "M-z M-z" to "zap-to-char" Option 3. C-o, with a single exception: "C-o C-o" would be bound to "open-line" Option 4. C-o and M-o, with two exceptions: "C-o C-o" would be bound to "open-line", and "M-o M-o" to "facemenu-keymap" =Rationale= The current key binding conventions (see `(elisp) Key Binding Conventions') reserve keys for users, for major modes and for minor modes, but not for third-party packages [1]. When such packages need to bind a command to a key, they can (1) either suggest users to bind it to a key reserved for users (for example, org-mode suggests to globally bind "C-c c" to org-capture), or (2) bind it to a key currently unused by Emacs (for example, Magit binds "C-x g" to magit-status in buffers visiting a file in a Git repository). Neither of these solutions are optimal: (1) requires an explicit configuration by the user, something which might confuse newcomers, and which other users might not want to do because they already use the keys reserved for users for other purposes, and (2) might conflict with the evolution of Emacs when one or more commands are bound to a yet unused key. Reserving one key for third-party packages solves the above problems: third-party packages can automatically bind a few keys in that reserved area, without conflicting with keys reserved for users and without conflicting with future Emacs evolutions. =Limit= Conflicts are still possible, when two or more packages bind the same keys. These are, however, conflicts between packages, not between a package and Emacs, or between a package and users' personal configurations. Such conflicts are also less likely for typical users, who install a few packages each binding a few keys. Finally, such conflicts can be dealt with without confusing users too much: a package could automatically choose fallback key bindings when the preferred ones are already used by another package, and/or issue a warning to the user that they need to bind its commands manually. =Note= [1] These conventions were written 25 years ago, at a time when there were far fewer third-party packages, and have not changed substantially since them.