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: Why is this-command-keys missing? Date: Sat, 01 Jan 2011 23:19:43 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1293941995 19056 80.91.229.12 (2 Jan 2011 04:19:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 2 Jan 2011 04:19:55 +0000 (UTC) Cc: Emacs-Devel devel To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 02 05:19:51 2011 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 1PZFQ7-0007XZ-Aw for ged-emacs-devel@m.gmane.org; Sun, 02 Jan 2011 05:19:51 +0100 Original-Received: from localhost ([127.0.0.1]:50341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZFQ6-0003zh-JE for ged-emacs-devel@m.gmane.org; Sat, 01 Jan 2011 23:19:50 -0500 Original-Received: from [140.186.70.92] (port=37912 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZFQ1-0003yo-Py for emacs-devel@gnu.org; Sat, 01 Jan 2011 23:19:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZFQ0-0000wI-TH for emacs-devel@gnu.org; Sat, 01 Jan 2011 23:19:45 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:32473 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZFQ0-0000wD-Qe for emacs-devel@gnu.org; Sat, 01 Jan 2011 23:19:44 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAL+LH01Ld/TY/2dsb2JhbACkR3S7MoVKBIRljhs X-IronPort-AV: E=Sophos;i="4.60,261,1291611600"; d="scan'208";a="86889034" Original-Received: from 75-119-244-216.dsl.teksavvy.com (HELO pastel.home) ([75.119.244.216]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 01 Jan 2011 23:19:44 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id C30E458DFC; Sat, 1 Jan 2011 23:19:43 -0500 (EST) In-Reply-To: (Lennart Borgman's message of "Sun, 2 Jan 2011 03:38:51 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:134152 Archived-At: > I am trying to use orgstruct-mode for a compilation output buffer. > orgstruct-mode binds keys like this: > ;; Special treatment needed for TAB and RET > (org-defkey orgstruct-mode-map [(tab)] > (orgstruct-make-binding 'org-cycle 102 [(tab)] "\C-i")) > (org-defkey orgstruct-mode-map "\C-i" > (orgstruct-make-binding 'org-cycle 103 "\C-i" [(tab)])) I don't know what this does, nor why it seems to bind both "\C-i" and [(tab)]. > However I would like to get back the normal TAB handling in the > compilation output buffer when not on an outline heading. So, you don't care which command was run, but instead you want to delegate to the other command which would be run if you ignore the "currently used" binding. This is a common need, of course. With many different solutions, none of them perfect: - Use a menu-item binding with a :filter so the binding can be computed dynamically (i.e. it's bound to org-cycle if point is on a heading, and to nil otherwise). - lookup with (key-binding (this-command-keys)) disabling your own key-binding (easy if it's on a minor-mode map or something similar). Usually (this-command-keys) does work, tho you claim it doesn't for you (still waiting for details on this problem). - lookup (key-binding ). - use a hard-coded fallback command. - disable your binding, then push this-command-raw-keys back on unread-command-events, while arranging to re-enable the binding after the next command. Stefan