From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.emacs.devel Subject: Key Mapping Proposal Date: Fri, 15 Jan 2010 19:03:03 -0500 Message-ID: <16d22e431001151603i5d2fab77u4f3054bb7e708323@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1263626103 15720 80.91.229.12 (16 Jan 2010 07:15:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 Jan 2010 07:15:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 16 08:14:56 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.50) id 1NW2s3-0003t1-MB for ged-emacs-devel@m.gmane.org; Sat, 16 Jan 2010 08:14:56 +0100 Original-Received: from localhost ([127.0.0.1]:35443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NW2s4-0003wB-21 for ged-emacs-devel@m.gmane.org; Sat, 16 Jan 2010 02:14:56 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NVw8G-0005OM-SY for emacs-devel@gnu.org; Fri, 15 Jan 2010 19:03:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NVw8C-0005MS-Fn for emacs-devel@gnu.org; Fri, 15 Jan 2010 19:03:12 -0500 Original-Received: from [199.232.76.173] (port=33648 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVw8C-0005MP-A9 for emacs-devel@gnu.org; Fri, 15 Jan 2010 19:03:08 -0500 Original-Received: from mail-yw0-f177.google.com ([209.85.211.177]:56613) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NVw8B-0000hl-Pa for emacs-devel@gnu.org; Fri, 15 Jan 2010 19:03:07 -0500 Original-Received: by ywh7 with SMTP id 7so1187002ywh.24 for ; Fri, 15 Jan 2010 16:03:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=8iUmSlhhw9CbeOShoJAZAL7ND126i0AESJL+nfM8GpQ=; b=rfBdEUVtYn9JLXgoUnvd01n+xgL7ENVgPp57AD8giypIeLXrPYShXNO+SYgbaG2J1q qap3v94+yj4vuhtAC8slKabjT4+pPx38yyxwXUHZ9UxLPNm7DfLQa4btr81Q6xxyb7vF ADFQOrWjOx9Yo70rgZkrB3elBjACvovk9uzt0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Qwnxh7FXFn6tvyXQXGJLGYgiRZwijiHnS+wmHBPKI/+2GunrdOce2vavt0jLfBfIPF OfiOUOkrK2be+18qTuGyrEKA6goMWYXmI+PLWdl/JajCoNIxkUZUyQ+XOHi+VGU0n4FR Uio0av5eU0i+oEAnj5wXkiFYEgpUxxWA2pu1w= Original-Received: by 10.101.136.12 with SMTP id o12mr5769819ann.26.1263600183691; Fri, 15 Jan 2010 16:03:03 -0800 (PST) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Sat, 16 Jan 2010 02:14:51 -0500 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:120088 Archived-At: Dear emacs-devel, I'd like to suggest a change to the way modes bind keys, to make it easier for users to customize keys. Right now, as far as I can tell, each mode defines some functions and then binds the appropriate keys to them. There are certain keys that have conventional meanings, so "C-f" means forward even if you're in picture-mode, and so on, and modes all try to respect this. The problem comes if you want to change the meaning of not just one key sequence, but the convention. Some people might like to use C-f, C-d, C-s, and C-e to move forward, down, back and up, because they're right next to each other. In order to achieve this now, you would need to rebind those keys in each mode that you use. It seems like there should be a better way. My suggestion is this: have one location which stores the user's keybinding for the "forward" key, whatever "forward" means for a particular mode. Any given mode would then use this to bind their particular "forward" function to whatever key the user wanted. Do the same for other keys with conventional meaning, and then modify the major modes to use these in their keybindings. One issue that might occur is if the user's bindings for a conventional key conflict with a binding unique to one particular major mode. You'd want a system for bouncing the other bindings around to prevent this, perhaps by keeping a list of unbound keys and then assigning the functions that need bindings to those keys one by one. This would give up the ability to give mnemonic key bindings to functions, but the issue would only occur if the user was customizing their keys, in which case it seems like the user's preferences should take priority. I'm happy to contribute work to this, but I wanted to ask emacs-devel first to see if you were interested in this, and if so, what you thought the right approach was. Thank you Noah Lavine