From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Uday S Reddy Newsgroups: gmane.emacs.devel Subject: Key bindings proposal [Was: Emacs learning curve] Date: Mon, 26 Jul 2010 23:01:58 +0100 Message-ID: <19534.1494.627000.357123@gargle.gargle.HOWL> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1280181749 17551 80.91.229.12 (26 Jul 2010 22:02:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 26 Jul 2010 22:02:29 +0000 (UTC) Cc: "Uday S. Reddy" , Teemu Likonen , emacs-devel@gnu.org To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 27 00:02:27 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OdVkg-0006JJ-GB for ged-emacs-devel@m.gmane.org; Tue, 27 Jul 2010 00:02:26 +0200 Original-Received: from localhost ([127.0.0.1]:54722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdVkg-0007j9-0Y for ged-emacs-devel@m.gmane.org; Mon, 26 Jul 2010 18:02:26 -0400 Original-Received: from [140.186.70.92] (port=46834 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdVka-0007j1-76 for emacs-devel@gnu.org; Mon, 26 Jul 2010 18:02:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdVkY-0006ei-Mx for emacs-devel@gnu.org; Mon, 26 Jul 2010 18:02:20 -0400 Original-Received: from sun60.bham.ac.uk ([147.188.128.137]:60613) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdVkY-0006eU-EU for emacs-devel@gnu.org; Mon, 26 Jul 2010 18:02:18 -0400 Original-Received: from [147.188.128.127] (helo=bham.ac.uk) by sun60.bham.ac.uk with esmtp (Exim 4.67) (envelope-from ) id 1OdVkT-0004L7-Nx; Mon, 26 Jul 2010 23:02:13 +0100 Original-Received: from mx1.cs.bham.ac.uk ([147.188.192.53]) by bham.ac.uk with esmtp (Exim 4.43) id 1OdVkT-0000BH-E4; Mon, 26 Jul 2010 23:02:13 +0100 Original-Received: from acws-0068.cs.bham.ac.uk ([147.188.194.56]) by mx1.cs.bham.ac.uk with esmtp (Exim 4.51) id 1OdVkV-0005Jl-LB; Mon, 26 Jul 2010 23:02:15 +0100 X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:127857 Archived-At: Stephen J. Turnbull writes: > It's trivial to change key bindings. M-x local-set-key RET > RET and Bob's your uncle. Or maybe > you want a swap-keys command that would have the UI M-x swap-keys RET > . I don't have that function on the top of my head, > but I'm pretty sure it requires at most three lines to express. Hi Stephen, I was going to reply to this originally saying that `local-set-key' and `global-set-key' are destructive change operations which shouldn't be taken lightly. They are kind of heavy duty hammers that are looking for nails to hit on and of course everything looks like a nail. I thought better of it because this thread had already been too long and wandering. But a post in the gnu.emacs.help newsgroup today prompted me to come back to it. The poster says: > For example now I just installed ruby-tests.el from emacswiki, which (I > saw too late) unfortunately has some "global-set-keys" with combinations > that normally I use for other things. > Is there any way to revert back to the last global state (it might be > useful also in other cases of cours)? If Emacs did take key binding customization seriously, it would have provided a whole bunch of *declarative* methods for specifying key bindings, along with rules for how they override each other or not override, as the need may be. If and when a set of key bindings needs to be installed (e.g., when a mode is entered), it would go and compile the key bindings from all the sources, detect conflicts if necessary, and install the right set. The user would be protected. The user wouldn't have to mess with mode-hooks or whatever. This is not an out-of-the-world idea. Almost all customization systems out there work this way. Instead, Emacs acts rather like a grumpy child that believes that it has the best key bindings already cased. And, local-set-key and global-set-key are like "if you really must change a key binding, well, go right ahead. Go and change all the key bindings if you want. I don't care." A totally unhelpful attitude. Yidong asked for a specific proposal if there is one. So, here is mine: Redesign Emacs so that key bindings can be designed by end users or third party customizers and exchanged with each other. It should be possible to change the entire set of key bindings in a running Emacs with the click of a button. If there are conflicts between different sets of key bindings that users import, there should be clear rules for what to do in such a case, an analysis of what goes wrong and gentle feedback given to the users. If you think that Emacs is alredy capable of doing all of this, then demonstrate it by implementing a radically different set of key bindings. Show the users how it can be done. Cheers, Uday PS: By the way, I sort of speak from experience here. I had RSI some 15 years ago and explored a whole bunch of options for how to change things, including going to Vim or Viper, using speech recognition, hand-writing etc.