From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Nordin Newsgroups: gmane.emacs.help Subject: Re: diff-goto-source hi-jacks my M-o Date: Mon, 28 Dec 2020 17:41:38 +0100 Message-ID: <87wnx16fy5.fsf@posteo.net> References: <87imf2gdnp.fsf@fliptop.i-did-not-set--mail-host-address--so-tickle-me> <87y2nx5472.fsf@fliptop.i-did-not-set--mail-host-address--so-tickle-me> <87pn985rwz.fsf@fliptop.i-did-not-set--mail-host-address--so-tickle-me> <87blef70bh.fsf@posteo.net> <87y2hjjgxf.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30195"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 28 17:42:21 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ktvbB-0007jX-Dj for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 28 Dec 2020 17:42:21 +0100 Original-Received: from localhost ([::1]:33122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktvbA-00084k-GW for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 28 Dec 2020 11:42:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktvae-00084V-B0 for help-gnu-emacs@gnu.org; Mon, 28 Dec 2020 11:41:50 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:42051) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktvaa-0001S5-C7 for help-gnu-emacs@gnu.org; Mon, 28 Dec 2020 11:41:47 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id C014716005C for ; Mon, 28 Dec 2020 17:41:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1609173699; bh=6XCJvO7VAbpJL490HYlkuJZa+KK6xJnmsTZPNRpL79w=; h=From:To:Subject:Date:From; b=flhxcTSx1s5LA6oYOpWwoGRID8+exZ3hbpsRMBRrpAiEwADhfkzZi7I+9/ZNK1bsb R3gEl91Z5rxvADQJwQu0fcs9oHAmEfCzY6RCONUj6g1gpxLrqoqL+WZHAeQnMQsFMg tUlqvcM2GJHChtJGDaouv0+o2MobTWbXbTyoaKlYbNG4sf2NZbH5CbQz0l8VDCxwQr Qo4rjSuSXphaKCqg0lHw41u/1EaGk6GpjahRsywWeQVNdT0HeP8YI9Res2vTWWT+Nl b3L9F+f+Ht1NuQPclC6weKZUYoNJetgXtsvYauMKQwh1OhneQ1105/thrUeenrGexd PUie4GC6H6Eeg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4D4Nc268fBz9rxD; Mon, 28 Dec 2020 17:41:38 +0100 (CET) In-Reply-To: <87y2hjjgxf.fsf@zoho.eu> Received-SPF: pass client-ip=185.67.36.65; envelope-from=tomasn@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126863 Archived-At: Emanuel Berg via Users list for the GNU Emacs text editor writes: > Tomas Nordin wrote: > >>> No, it's not required there, you are free to enable >>> =E2=80=98my-precious-keys-map=E2=80=99 unconditionally as well: >>> >>> (add-to-list 'emulation-mode-map-alists >>> (list (cons t my-precious-keys-map))) >>> >>> if you feel that you will never need to suspend it. >> >> Alright, then we know the way to go if we have a set of >> bindings that must never be "hi-jacked" >> >>>> And that the trickery with the key-maps is hard to follow >>>> for me. >>> >>> There is no any trickery, just a hardcoded priority order >>> in Emacs itself: global map is overridden by major mode >>> map, which in turn is overridden by minor mode maps, which >>> can be overridden by emulation mode maps. >>> >>> That is, using a minor mode map would suffice in your >>> specific case =E2=80=94 about M-o in diff-mode. But so would >>> a mere: >>> >>> (with-eval-after-load 'diff-mode >>> (define-key diff-mode-map >>> (kbd "M-o") nil)) ; also on RET, o, C-c C-c, which is more than en= ough >> >> That's the way I go about it. It is rare enough this binding >> is used anywhere (apart from the original binding about >> setting face of course) > > Don't know what this discussion is about but I use M-o all the > time! It is so comfortable, and requires minimal finger Indispensable! > movement from "asdf/jkl;" - I have it "other-window-or-split" [1] > which is like pretty much the foundation of my ways with windows, not > unlike a bunch of Isaac Asimov novels I keep under one table leg, to > prevent it from wobbling... > > The way I solved it with M-o (this was ages ago, I set this > up) I put that and other untouchable keys in > "super-global-keys" and then for every mode that dares > infringe, which is evident instantly, I call > "disable-super-global-keys" > > (defun disable-super-global-keys (&optional map) > "Disable the super global keys so they can be assigned. > Use the current map unless MAP is provided." > (dolist (k super-global-keys) > (define-key (or map (current-local-map)) k nil) )) ; [2] > > In all my Emacs I have called it 22 times, so maybe that is an > approximation of the number of modes that had to be told "step > back son, there is nothing to see". See the suggestion from Dmitry upthread, it was a way to let a binding be available always as I understand, by one code block using `emulation-mode-map-alists'. I wonder what all those 22 situations are where you need to nil the binding out. So far it happened only in diff-mode for me. I set my precious binding like this (global-set-key (kbd "M-o") 'other-window) but diff-mode took it. Ahh, but now I understand. You have all sorts of bindings you enforce around Emacs? The suggestion upthread seem to be good for that. > > No idea if this solution is even close to canonical, probably > not, but it seems bulletproof enough, so I thought I'd tell > you about it. Thanks -- Tomas