From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Stop modes from hijacking several global keys Date: Wed, 05 Nov 2014 12:38:56 +0100 Message-ID: <87a94598rz.fsf@thinkpad-t440p.tsdh.org> References: <87wq7a3zb0.fsf@thinkpad-t440p.tsdh.org> <87sihy3yuv.fsf@thinkpad-t440p.tsdh.org> <87lhnqougl.fsf@yahoo.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415187571 10996 80.91.229.3 (5 Nov 2014 11:39:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Nov 2014 11:39:31 +0000 (UTC) Cc: help-gnu-emacs To: Nicolas Richard Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 05 12:39:24 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1Xlyvq-0003bF-Nj for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Nov 2014 12:39:22 +0100 Original-Received: from localhost ([::1]:45874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xlyvq-000066-8k for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Nov 2014 06:39:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlyvY-0008Vt-5V for help-gnu-emacs@gnu.org; Wed, 05 Nov 2014 06:39:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlyvS-00044K-DY for help-gnu-emacs@gnu.org; Wed, 05 Nov 2014 06:39:04 -0500 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:53874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlyvS-000447-6v for help-gnu-emacs@gnu.org; Wed, 05 Nov 2014 06:38:58 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 238C81A83E9; Wed, 5 Nov 2014 12:38:57 +0100 (CET) X-Virus-Scanned: amavisd-new at uni-koblenz.de Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B4PZIQbiI7JE; Wed, 5 Nov 2014 12:38:56 +0100 (CET) X-CHKRCPT: Envelopesender noch tsdh@gnu.org Original-Received: from thinkpad-t440p.tsdh.org (dhcp133.uni-koblenz.de [141.26.71.133]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 7D58A1A83E8; Wed, 5 Nov 2014 12:38:56 +0100 (CET) Mail-Followup-To: Nicolas Richard , help-gnu-emacs In-Reply-To: <87lhnqougl.fsf@yahoo.fr> (Nicolas Richard's message of "Wed, 05 Nov 2014 10:41:30 +0100") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.15 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100760 Archived-At: Nicolas Richard writes: Hi Nicolas, >>> Ideally, that magic would stop the mode from hijacking M- >>> keys, and whatever it wants to bind to M- would >>> automagically be bound to ` M-' instead. >>> >>> I think at least for major-modes I can use >>> `after-change-major-mode-hook' in combination with a function >>> checking (key-binding (kbd "M-")) and doing `local-set-key' >>> if needed. > > Since minor modes have precedence of major modes, you could define > your own minor mode with those keybindings. I don't think that would make a difference. Note that I want the commands that a (major-) mode would bind to `M-' to be still available via ` M-', so I'd need to do what `th/select-nth-window-ensure-keys' from my previous mail does whenever my mode is activated. (And for it to be a proper minor-mode, it should undo that when it gets deactivated.) Looking at `define-globalized-minor-mode' that basically does the same what I did: put a function in `after-change-major-mode-hook' that enables the minor-mode. I've put a function there that reclaims my keys. And then the problem of a minor-mode that gets activated after my own minor-mode and then again steals my keys isn't solved, too. For that, I'd somehow need to ensure that my own minor-mode (or currently my gimme-back-my-keys function) is and always stays the last function run by `after-change-major-mode-hook'. Anyway, this is now a more or less theoretical discussion because until now it have always been major modes stealing my keys. And by convention, a minor-mode shouldn't bind M- anyway. Bye, Tassilo