From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: Emacs default key bindings [was: Opening Up More Keymaps Re: Standardizing more key bindings?] Date: Fri, 2 Oct 2020 11:14:48 -0700 (PDT) Message-ID: <364afb35-1cf9-4bd8-a34d-370dc428f950@default> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19727"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: "T.V Raman" , Thibaut Verron Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 02 20:17:38 2020 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 1kOPcf-000506-Ry for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Oct 2020 20:17:37 +0200 Original-Received: from localhost ([::1]:49592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOPce-0000kc-V5 for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Oct 2020 14:17:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOPa7-00087C-9K for emacs-devel@gnu.org; Fri, 02 Oct 2020 14:14:59 -0400 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:52516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOPa4-0007X2-Gf for emacs-devel@gnu.org; Fri, 02 Oct 2020 14:14:58 -0400 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 092IDgsr184829; Fri, 2 Oct 2020 18:14:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=CXEcvlCeoofCjv6vQ4/Xk8AfP7qYHnewUPsB1TlXui8=; b=Ghoa7PFxwmACn/G2k28mEJDeNeqaqSIYOrTT8s24p0xkZOk0jNjkclAHmd8P7MmZnyJG btXEu9O3KKDDAO5+gjH9q8d9cvtt9F18Q9+tmXkBhiN54Cu9AYon71p2atPj0bw3dR5Z mJc5bp35rWvvBSBxji35jRPGpOuu2GmlJOeu4HIrSIHwQMhhqvVBvWIgAID02EE0QU4F DpkEllLPDpxduIj0ymrHnsFCGeRA8WoX0Tpuk0IMwbCZA+g/0loQ3CRgZfUhGYyP4knq 0a+sBLnHu1f9Adxyqp7jARsbUJn5s24YDdwnfZ5YPnmGDhGNM594Nbc09wOGe0yhqi7Y Vw== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 33swkmc95n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 02 Oct 2020 18:14:51 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 092I9tiK154049; Fri, 2 Oct 2020 18:14:50 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 33tfk3uwpf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Oct 2020 18:14:50 +0000 Original-Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 092IEnwt015889; Fri, 2 Oct 2020 18:14:49 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5056.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9762 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=918 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010020132 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9762 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=933 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010020132 Received-SPF: pass client-ip=141.146.126.78; envelope-from=drew.adams@oracle.com; helo=aserp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 14:14:53 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, 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:256959 Archived-At: > Perhaps it's time we opened up some additional keymaps... Stayed out of this thread so far, hoping it would die a healthy natural death. ;-) But here are my general thoughts on the matter, FWIW. ___ 1. Keyboard keys are scarce. Many are already "taken" by default by Emacs. (Yes, of course, users and libraries can always _override_ any default bindings.) Some of the keys Emacs has "taken" could fruitfully be revisited. Some are easily repeatable keys that are bound by default to nonrepeatable commands, i.e., commands that it makes no sense to hold the key down to repeat. Some are particularly easy/quick to type, and are bound to commands that might not be used that often. Some were perhaps taken only because a key seemed to be free at the time (often long ago), regardless of how much a default binding was needed. (Recently F2 has come up, as having been sacrificed for the relatively unused/not-so-useful `2C-*' commands.) Any such keys could be looked at as keys we might possibly want to "open up". (And no, I'm not saying that there aren't other things to take into account when deciding on a default key binding. Ease/speed of finger access, for example.) 2. But what do we mean by "open up" or "free" a default key binding? _I_ mean free it for use by users and 3rd-party libraries. Have Emacs give it up - let it go. I don't mean for Emacs to just bind it to something different by default. That's _not_ freeing it up; that's just rearranging. Rearranging can be useful sometimes, but it doesn't help with the problem of Emacs binding too many keys by default. Some here feel the pinch as Emacs not having enough free keys to bind to more commands by default. I feel the problem is the opposite: the pinch is on users and 3rd-party libraries, and Emacs is doing the pinching. Some here see a "free" key and want to bind it by default, sometimes to their shiny new command. 3. There's been a tendency recently to give Emacs even more default key bindings. Two cases come to mind, both in 2020: a. `C-x p' was taken by Emacs as a prefix key for `project.el' commands. b. `C-x t' was taken by Emacs as a prefix key for `tabbar.el' commands. Maybe those deserve prefix keys (?). But you see the tendency - less and less for users; more taken by default bindings. That's 2 excellent prefix keys just removed, in effect, from the user/3rd-party space. Poof! For example, in my code I've used `C-x p' and `C-x 4 p' as prefix keys for Bookmark+ for over 10 years, but I changed them (`C-x x', `C-x 4 x') in 2020 because of (a). (I have 86 key bindings organized onto those two prefix keys - some on submaps: `C-x x a', `C-x x b', `C-x x c', `C-x x t', `C-x x t +',...) And I've used `C-x t' as a suggested prefix key for library DoReMi for 16 years. But I'll have to change that in 2020 because of (b). I pointed this out here at the time. Response was, in effect, "tough tiddlywinks". OK. https://lists.gnu.org/archive/html/emacs-devel/2019-12/msg00085.html The point is that instead of Emacs trying to reserve _more_ keys as free for its users (without having to override default bindings), the impetus here has been to sacrifice ever more keys to default bindings. 4. When Emacs does decide to bind a key by default, these two general guidelines (at least) should be considered, IMO. (This applies to rearranging, as well as to binding a previously free key.) =20 1. Save naturally repeatable keys for commands that can be repeated, i.e., commands that it makes sense to be able to hold down a key to repeat. 2. Save some keys for prefix keys, as opposed to just sacrificing them for a single command. A prefix key gives you a whole keyboard of possibilities for a single key. Think of all the mileage we get out of the prefix key `C-x'! Of course, adding a prefix key makes a key sequence longer, more complex. Tradeoff. ___________________ That point (#4) and the rest of this message were part of a post of mine to help-gnu-emacs on 9/23/2020, on pretty much this same topic: https://lists.gnu.org/archive/html/help-gnu-emacs/2020-09/msg00273.html I tend to define lots of keys for features I write, and put them, by groups, on their own keymaps, and then put those keymaps on prefix keys. Even if such a prefix key appears complicated or slow, the fact of using a separate keymap means that a user can easily put it on a different, shorter key, or remap it to a more global keymap. Now imagine that keys aren't reserved by Emacs this way - repeatable keys for repeatable commands, and some keys available to be used as prefix keys. Imagine if Emacs just predefined `C-x' for a single command (e.g. `cut'). _Zillions_ of keys bound now under `C-x' would be sacrificed. At the very least, when a new key is decided to be sacrificed by default (vanilla Emacs), it had better be bound to a repeatable command, not one (such as `cut') that it makes no sense to repeat. And even a repeatable key is a sacrifice - consider if `C-x' were bound to, say, `forward-word'. Repeatable, yes, but think of all the bindings now under `C-x' that would be lost. Keyboard keys are precious - scarce. Too many have already been sacrificed to default bindings, IMO. Sure, any user or library can redefine any keys. But once blessed as a default vanilla-Emacs key binding, a key is, for practical purposes, kinda off limits for a library. The point is that (1) it's easy to move a keymap from one prefix key to another, and (2) there need to be some prefix keys available to move maps to. Eventually, I imagine (hope) that some simple, repeatable keys that have been assigned default Emacs bindings for commands that aren't repeatable, or that aren't super useful, or that don't really need a single-key binding, will be recycled and put to better use: for repeatable commands, as prefix keys, or just unbound by default and left available for libraries. No, I don't have particular suggestions, and no, it's not urgent. But consider `M-!', for example. Sure, `!' is mnemonic for shell. But `M-!' is repeatable (just hold it down), and it makes no sense to repeat `shell-command'. There are other default key bindings like this - essentially wasted wrt easy repetition. Some nonrepeatable commands bound to repeatable keys should be replaced by repeatable versions. I do that for `C-a' and `C-e', for example, so they're similar to `C-n' and `C-p' (repeatable). That kind of change is minimal - it's the least we can do to make things a little saner. Take a look at `C-h b', and see which repeatable keys are bound to nonrepeatable commands. Not too many, but there are some. Even `C-w' is "wasted" on a nonrepeatable command. Am I suggesting that `C-w' should not be bound by default to `kill-region'? Not really. That's not urgent, at least. But hey, keys are limited - the keyboard's a small planet. ;-) And `beginning-of-buffer'. That nonrepeatable command's bound by default to two repeatable keys, `M-<' and `C-home'. Both mnemonic (good). But...