From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Key bindings proposal Date: Tue, 27 Jul 2010 12:32:57 +0200 Message-ID: References: <19534.1494.627000.357123@gargle.gargle.HOWL> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1280226856 5543 80.91.229.12 (27 Jul 2010 10:34:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Jul 2010 10:34:16 +0000 (UTC) Cc: "Stephen J. Turnbull" , Teemu Likonen , emacs-devel@gnu.org To: Uday S Reddy Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 27 12:34:15 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 1OdhUE-0002WX-Eb for ged-emacs-devel@m.gmane.org; Tue, 27 Jul 2010 12:34:14 +0200 Original-Received: from localhost ([127.0.0.1]:54114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdhUD-0006FR-PJ for ged-emacs-devel@m.gmane.org; Tue, 27 Jul 2010 06:34:13 -0400 Original-Received: from [140.186.70.92] (port=34769 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdhU6-0006FH-KF for emacs-devel@gnu.org; Tue, 27 Jul 2010 06:34:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdhU5-0002Hs-Cd for emacs-devel@gnu.org; Tue, 27 Jul 2010 06:34:06 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:34221) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdhU5-0002HA-5n for emacs-devel@gnu.org; Tue, 27 Jul 2010 06:34:05 -0400 Original-Received: from ceviche.home (vpn-132-204-232-20.acd.umontreal.ca [132.204.232.20]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id o6RAWwYr027438; Tue, 27 Jul 2010 06:33:00 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 91CF36611D; Tue, 27 Jul 2010 12:32:57 +0200 (CEST) In-Reply-To: <19534.1494.627000.357123@gargle.gargle.HOWL> (Uday S. Reddy's message of "Mon, 26 Jul 2010 23:01:58 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3586=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:127867 Archived-At: > 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. I understand what you want. But, I'm not 100% sure what a good solution would look like, and I'm even less clear on how we could get to such a solution starting from Emacs's current system. The main problem is not whether the method is declarative or not, but rather the problem is to make intentions clear. The issue with "intentions" is typically along the lines of "do you want to bind `foo' to C-x C-x or do you want to bind it to the C-x key within the main prefix keymap, or do you want to bind it to the repetition of the key-sequence to which this main keymap is bound, or maybe only to the repetition of just the last key in this key-sequence, or maybe to the repetition of C-"the key above my "alt" key, or maybe you want to bind it to whichever key `foobar' is bound in such-and-such-mode, ..." If all Emacs packages could replace their `define-key' calls by others that make the intentions clear, then it would be a lot easier/cleaner to redefine key-bindings. But if you look at the average quality of Elisp code, you'll quickly learn that most authors have much better things to do than to worry about such problems (i.e. their main worry is to get it to work for the very specific Emacs they're currently using, with their current .emacs). Using `remap' is one way to express such an intention. I would welcome patches that try to make intentions more clear (e.g. eliminate the massive hardcoding of the "C-c" prefix all over the place) and have myself replaced bindings to TAB and to M-q many times by settings of indent-line-function and fill-paragraph-functions. We can keep improving in that direction, but the important part is that such changes should be made in such a way that it's easy for coder to follow the new style (ideally: easier than using the old inflexible style). > it would go and compile the key bindings from all the sources, detect > conflicts if necessary, and install the right set. That's yet more difficult. It means that the author and/or the user needs to explicitly indicate when something should take precedence over something else, and when not. In most cases I know of, this tends to be too heavy to use and instead the system is designed to use a default precedence scheme (witness the "use first matching pattern" rule in ML-style or Prolog pattern matching). So I'd expect "conflict detection" to come with a lot of user complaints (already we have occasional bug-reports about the errors signaled by define-key when you define a binding for C-a C-b when C-a is already bound to a command). Stefan