From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: mr.meowking--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72624: 31.0.50; minor-mode-overriding-map-alist doesn't have higher priority than local map, which differs from docs Date: Wed, 14 Aug 2024 17:45:03 +0200 (CEST) Message-ID: Reply-To: mr.meowking@tutamail.com 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="21275"; mail-complaints-to="usenet@ciao.gmane.io" To: 72624@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 14 17:50:43 2024 Return-path: Envelope-to: geb-bug-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 1seGGo-0005Ms-Qw for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Aug 2024 17:50:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1seGGa-0006tg-Mm; Wed, 14 Aug 2024 11:50:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1seGGa-0006tW-4b for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 11:50:28 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1seGGZ-0002Iu-Rf for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 11:50:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:From:Date:To:Subject; bh=QPbVLUJ3ZK2+TS5WzA7SSwYlHkJVCFpIxJQowqaCIOs=; b=YKxQ5rpYJGvX/M4/yngxuX5WEJgrb0Ti4AV8vk8LcMe01uuxTCnNbPpBHa18xpp2x9I+DGuPgnLPcBpOg0JOhCXu2tzvmq6w1bMfnlqMgrwi8jjQuupJKQTp7FdQ1FQwtzk0XfnpHtrK5KzD3CAKQs1AEp2gbAMtSMeuw3YfK+ugToqhZoRI0IONDEEsghLVFXM7CKjOX+9gJjdvsCh8ygiTr8ZK+Jn0QAHvxvauJcedj74zf9Ri31QLyFGD7PDlfyffzNcpyQtf5K/sJ8zHj5nSVPdApcNACawL+fB65Nvz2+egT/BlceVu7IN/ajmvjlVj/d7lYzfGPoiUY14f8Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1seGH8-0000QY-NQ for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 11:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: mr.meowking@tutamail.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Aug 2024 15:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72624 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Bug Gnu Emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.17236506321589 (code B ref -1); Wed, 14 Aug 2024 15:51:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Aug 2024 15:50:32 +0000 Original-Received: from localhost ([127.0.0.1]:47281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seGGd-0000PY-VM for submit@debbugs.gnu.org; Wed, 14 Aug 2024 11:50:32 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:59744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seGCA-0000G5-20 for submit@debbugs.gnu.org; Wed, 14 Aug 2024 11:45:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1seGBT-0005xO-NJ for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 11:45:12 -0400 Original-Received: from mail.w13.tutanota.de ([185.205.69.213]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1seGBP-0001Jc-MM for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 11:45:09 -0400 Original-Received: from tutadb.w10.tutanota.de (w10.api.tuta.com [IPv6:fd:ac::d:10]) by mail.w13.tutanota.de (Postfix) with ESMTP id BF6B9154A966 for ; Wed, 14 Aug 2024 17:45:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1723650303; s=s1; d=tutamail.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=QPbVLUJ3ZK2+TS5WzA7SSwYlHkJVCFpIxJQowqaCIOs=; b=qt/ATCAU5bp4qTyTkALaDUBFfL0CKSgAX8N6DT3PpQyQwXMnWL4JIgW0Pju0576s hgVZLG2CfwDZV/nRj2SbadpZr9Xzbg5SAFlhqi7a82eYgLGYoGtU/a1O9GWq2fA+53T 02KFJqRyHl9zaRooATghAJ01/4BQDPGJUIds/l6FPOj+tW4yQMiu9KMJEWe1cy8yhBc N2nicI8DJFMmfIvlD4eYWBtmSPPcZPigyj2L9+3QcU7z0gFM/db10r/CrEMHh3TzgTq o/lNZlZ8xlF2F3/ElJaC5NT45rUKbTREmA1kKg3o10nqO4lAuoUW526jsa9jtJcV3SO kI6+FMdhPw== Received-SPF: pass client-ip=185.205.69.213; envelope-from=mr.meowking@tutamail.com; helo=mail.w13.tutanota.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 14 Aug 2024 11:50:31 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290148 Archived-At: NOTE: please view https://codeberg.org/meow_king/typst-ts-mode/issues/6#issuecomment-2174390 for rendered markdown view. According to docs `(elisp) Active Keymaps` : > Emacs contains many keymaps, but at any time only a few keymaps are =E2=80=9Cactive=E2=80=9D.=C2=A0 When Emacs receives user input, it translat= es the input event (*note Translation Keymaps::), and looks for a key binding in the active keymaps. > >=C2=A0=C2=A0 Usually, the active keymaps are: (i) the keymap specified by = the =E2=80=98keymap=E2=80=99 property, (ii) the keymaps of enabled minor modes,= (iii) the current buffer's local keymap, and (iv) the global keymap, in that order.=C2=A0 Emacs searches for each input key sequence in all these keymap= s. > >=C2=A0=C2=A0 Of these usual keymaps, the highest-precedence one is specifi= ed by the =E2=80=98keymap=E2=80=99 text or overlay property at point, if any.=C2= =A0 (For a mouse input event, Emacs uses the event position instead of point; *note Searching Keymaps::.) > >=C2=A0=C2=A0 Next in precedence are keymaps specified by enabled minor mod= es. These keymaps, if any, are specified by the variables =E2=80=98emulation-mode-map-alists=E2=80=99, =E2=80=98minor-mode-overriding= -map-alist=E2=80=99, and =E2=80=98minor-mode-map-alist=E2=80=99.=C2=A0 *Note Controlling Active Maps= ::. > >=C2=A0=C2=A0 Next in precedence is the buffer's =E2=80=9Clocal keymap=E2= =80=9D, containing key bindings specific to the buffer.=C2=A0 The minibuffer also has a local keym= ap (*note Intro to Minibuffers::).=C2=A0 If there is a =E2=80=98local-map=E2= =80=99 text or overlay property at point, that specifies the local keymap to use, in place of the buffer's default local keymap. =E2=80=98minor-mode-overriding-map-alist` should have higher priority than = the buffer local keymap. However, the actual behavior is different than what the docs say. Here is my test: ```elisp ;;;###autoload (defvar-keymap typst-ts-mode-map ;; .. "RET" #'typst-ts-mode-return) (defvar-keymap mk/test-map "RET" #'(lambda () (interactive) (message "mk/test-map"))) ;;;###autoload (define-derived-mode typst-ts-mode text-mode "Typst" "Major mode for editing Typst, powered by tree-sitter." :group 'typst :syntax-table typst-ts-mode-syntax-table :after-hook (typst-ts-mode-after-hook-function) (setq minor-mode-overriding-map-alist '((outline-minor-mode . nil))) (setcdr (assq #'outline-minor-mode minor-mode-overriding-map-alist) mk/test= -map) ;; ... ) ``` In this situation, `typst-ts-mode-return` will be executed.=C2=A0 If we execute this elisp code and then re-enter `typst-ts-mode` ```elisp=C2=A0 (keymap-set outline-minor-mode-map "" #'(lambda () (interactive) (m= essage "outline-minor-mode-map"))) ``` it will still execute `typst-ts-mode-return` function. However, in addition of the previous code, if we then remove the following = code in `typst-ts-mode` setup process: ```elisp (setq minor-mode-overriding-map-alist '((outline-minor-mode . nil))) (setcdr (assq #'outline-minor-mode minor-mode-overriding-map-alist) mk/test= -map) ``` then the lambda function in `outline-minor-mode-map` will be executed.=C2= =A0 ---=C2=A0 In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) Repository revision: 643b564bd38cf037c55dba1a160b7d0c4c8355a9 Repository branch: master System Description: NixOS 24.11 (Vicuna) Configured using: 'configure --prefix=3D/nix/store/dj6bh0vp6gzqdmb3ilri3aw5kcq62myf-emacs-pgtk-20240811.= 0 --disable-build-details --with-modules --with-pgtk --with-compress-install --with-toolkit-scroll-bars --with-native-compilation --without-imagemagick --with-mailutils --without-small-ja-dic --with-tree-sitter --without-xinput2 --with-xwidgets --with-dbus --with-selinux'