From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Get a command by its keybinding and also respecting keytranslation Date: Wed, 15 Dec 2010 14:03:38 -0800 Message-ID: References: <871v5lpkk6.fsf@member.fsf.org><201012150921.22238.tassilo@member.fsf.org> <201012151627.04199.tassilo@member.fsf.org> 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 1292450660 4910 80.91.229.12 (15 Dec 2010 22:04:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 15 Dec 2010 22:04:20 +0000 (UTC) Cc: 'Stefan Monnier' To: "'Tassilo Horn'" , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 15 23:04:16 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 1PSzSJ-0001Cl-1c for ged-emacs-devel@m.gmane.org; Wed, 15 Dec 2010 23:04:15 +0100 Original-Received: from localhost ([127.0.0.1]:49485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSzSI-0001ZN-Fg for ged-emacs-devel@m.gmane.org; Wed, 15 Dec 2010 17:04:14 -0500 Original-Received: from [140.186.70.92] (port=60362 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSzSC-0001ZI-64 for emacs-devel@gnu.org; Wed, 15 Dec 2010 17:04:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PSzSA-0004Vf-UO for emacs-devel@gnu.org; Wed, 15 Dec 2010 17:04:07 -0500 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:43024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PSzSA-0004VT-MX for emacs-devel@gnu.org; Wed, 15 Dec 2010 17:04:06 -0500 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id oBFM43w6008083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 15 Dec 2010 22:04:05 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id oBFM3sVk016259; Wed, 15 Dec 2010 22:03:54 GMT Original-Received: from abhmt020.oracle.com by acsmt353.oracle.com with ESMTP id 878549691292450619; Wed, 15 Dec 2010 14:03:39 -0800 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 15 Dec 2010 14:03:39 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <201012151627.04199.tassilo@member.fsf.org> Thread-Index: AcucbI8EwfZfWJo4T4KtcxiFmPj5XwANHBOg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 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:133730 Archived-At: I think I see what you want, but I'm not getting part of the why (use case). Can you describe a bit what the advantage is in doing this at a key-binding level rather than at a command level? IOW, I imagine that this must save you some trouble but I'm not sure what that savings is. What is the advantage over defining a dispatching command and binding that to the key? E.g., (defun my-dispatch-cmd () "..." (interactive) (cond (blah (foo)) (toto (call-interactively #'fee)) (titi (call-interactively #'bar)) (tata (booph)) (t (call-interactively default-command)))) Stefan's suggestion was at the key-binding level, like yours, but I think its effect is pretty much the same as binding a command that tests the conditions (?). You contrasted your proposal with Stefan's suggestion, saying that yours allowed for multiple bindings of the same key, applying whichever binding was appropriate in context (using a priority order and conditions IIUC). But I don't get that point. What is the advantage of having multiple bindings for the same key (in the same map) and picking which is used according to a condition? Why not just bind the key to a command that tests those same conditions? What am I missing?