From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: diff-goto-source hi-jacks my M-o Date: Sun, 27 Dec 2020 18:29:48 +0100 Message-ID: <87y2hjjgxf.fsf@zoho.eu> 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> Reply-To: Emanuel Berg Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9308"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:g+6tVWnjhz892Rssw/cDF3jto50= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 27 18:31:12 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 1ktZss-0002Ip-RU for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 27 Dec 2020 18:31:10 +0100 Original-Received: from localhost ([::1]:52198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktZsr-0003Eb-Rc for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 27 Dec 2020 12:31:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktZri-0003Dv-Mp for help-gnu-emacs@gnu.org; Sun, 27 Dec 2020 12:30:00 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:38666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktZrg-0006pY-CJ for help-gnu-emacs@gnu.org; Sun, 27 Dec 2020 12:29:57 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1ktZre-000158-3M for help-gnu-emacs@gnu.org; Sun, 27 Dec 2020 18:29:54 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.248, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:126810 Archived-At: Tomas Nordin wrote: >> No, it's not required there, you are free to enable >> ‘my-precious-keys-map’ 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 — 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 enough > > 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 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". 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. [1] https://dataswamp.org/~incal/emacs-init/window-new.el line 31 [2] https://dataswamp.org/~incal/emacs-init/super.el -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal