From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Andrus Newsgroups: gmane.emacs.devel Subject: Re: Binding C-i breaks TAB bindings (was bug#13861) Date: Mon, 4 Mar 2013 11:21:28 -0700 Message-ID: <9A703259-6647-4787-B79B-96D3E3435407@gmail.com> References: <87a9qklpoa.fsf@kanis.fr> <87boazveav.fsf_-_@kanis.fr> <871ubv6o7h.fsf@kanis.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1362421303 28188 80.91.229.3 (4 Mar 2013 18:21:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Mar 2013 18:21:43 +0000 (UTC) Cc: Stefan Monnier , Emacs Development List To: Ivan Kanis Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 04 19:22:05 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UCa1U-0007Oo-NO for ged-emacs-devel@m.gmane.org; Mon, 04 Mar 2013 19:22:04 +0100 Original-Received: from localhost ([::1]:57030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCa19-00012r-4E for ged-emacs-devel@m.gmane.org; Mon, 04 Mar 2013 13:21:43 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCa13-0000xd-1W for emacs-devel@gnu.org; Mon, 04 Mar 2013 13:21:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCa0y-0008FL-V6 for emacs-devel@gnu.org; Mon, 04 Mar 2013 13:21:36 -0500 Original-Received: from mail-da0-f54.google.com ([209.85.210.54]:56821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCa0y-0008F2-OX for emacs-devel@gnu.org; Mon, 04 Mar 2013 13:21:32 -0500 Original-Received: by mail-da0-f54.google.com with SMTP id p1so2677381dad.27 for ; Mon, 04 Mar 2013 10:21:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :cc:content-transfer-encoding:message-id:references:to:x-mailer; bh=aWq/wq9aoNOi51jF9AiojpVLoJo6GJjTzI8ZNSWdY0A=; b=RCvJrc1BbPLAhRNSn+srQaNsG58/GGQoGmCv/DHAB1FDpW9DEI/hBLHI5iNkBQPE5b BRSLV+JJQrJQ3v+9BX1VR67JDLzLWA32yqoJTKMLmLNOowThcW9ThgK9+pI/qTtrFGde NQNrWOur73c8vTZzIehEzRqJFuf2yUJslzzRQyT5zmv9tgVINgTgYpgihqrZoSO+xxLJ GtHzGFjYJ1J2CWUnhwkkrfyN7djkEjkMCS5B9qls1ny1al+qRFaA8sPm+1zIR1pqWUEW Mw0xkLT6aqR+dsFmOvNEXnGz2vhxTaIlUmMWmpqRfRDvsKO4ClJGgjd5bO9lgPyK5xbG V38w== X-Received: by 10.68.204.97 with SMTP id kx1mr30297563pbc.117.1362421291472; Mon, 04 Mar 2013 10:21:31 -0800 (PST) Original-Received: from [10.0.2.30] (host-69-145-52-115.bln-mt.client.bresnan.net. [69.145.52.115]) by mx.google.com with ESMTPS id 1sm23160866pba.32.2013.03.04.10.21.30 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Mar 2013 10:21:30 -0800 (PST) In-Reply-To: <871ubv6o7h.fsf@kanis.fr> X-Mailer: Apple Mail (2.1499) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.210.54 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157509 Archived-At: On Mar 4, 2013, at 10:59 AM, Ivan Kanis wrote: > March, 04 at 9:28 Stefan wrote: >=20 >> In any case is not overridden. It's just that you don't have = any >> binding for so function-key-map makes Emacs fallback on the >> C-i binding. >=20 > OK, I think I finally understand. >=20 > C-h k TAB =3D> TAB (translated from ) runs the command ... >=20 > I missed the 'translated from' bit. >=20 > I am trying to free up C-i for my nefarious purpose. Does that mean I > have to fix each mode I use to bind the key to the proper = command? > Is there a programmatic way? The way I do it is by creating a minor-mode (called `gvol-mode'), and = bind C-i to whatever I want. Then I bind to the function below = which turns off gvol-mode and finds the "best" keybinding and runs it. = It's not perfect, and you sometimes run into problems that are somewhat = difficult to diagnose which I have worked around with the setq's. HTH, Ivan (defun gvol-indent-for-tab-command () "This is to fix `indent-for-tab-command' for `gvol-mode'. It runs [tab] or C-i with `gvol-mode' nil because `gvol-mode' binds C-i to a different command. Ideally this should take into account window system so that it can DTRT in a terminal (whatever the right thing is)." (interactive) (let* ((gvol-mode nil) (command (or (key-binding [tab]) (key-binding "\C-i")))) ;; This is to satisfy `python-indent-line' which checks ;; `this-command' to cycle (setq this-command 'indent-for-tab-command) ;; Make people think this was called with C-i. This allows ;; `self-insert-command' to work (setq last-command-event 9) (call-interactively command)))=