GNU logs - #54074, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Ergus <spacibba@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 20 Feb 2022 19:06:01 +0000
Resent-Message-ID: <handler.54074.B.164538392319254 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 54074 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.164538392319254
          (code B ref -1); Sun, 20 Feb 2022 19:06:01 +0000
Received: (at submit) by debbugs.gnu.org; 20 Feb 2022 19:05:23 +0000
Received: from localhost ([127.0.0.1]:33755 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nLrWM-00050P-Vx
	for submit <at> debbugs.gnu.org; Sun, 20 Feb 2022 14:05:23 -0500
Received: from lists.gnu.org ([209.51.188.17]:48568)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <spacibba@HIDDEN>) id 1nLrWL-00050H-AM
 for submit <at> debbugs.gnu.org; Sun, 20 Feb 2022 14:05:21 -0500
Received: from eggs.gnu.org ([209.51.188.92]:51550)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <spacibba@HIDDEN>) id 1nLrWL-00012F-5c
 for bug-gnu-emacs@HIDDEN; Sun, 20 Feb 2022 14:05:21 -0500
Received: from sonic303-3.consmr.mail.bf2.yahoo.com ([74.6.131.42]:46399)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <spacibba@HIDDEN>) id 1nLrWH-00032O-NF
 for bug-gnu-emacs@HIDDEN; Sun, 20 Feb 2022 14:05:20 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
 t=1645383916; bh=lXDhdOW3jYzOqMgyder1NIeUjGWfGKL7UnokuWL/jdo=;
 h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To;
 b=qjx5j7Udl0oa+nyI6x1vxN6fChD3gQOQTcNFB+z7m4q2Sim2IiNSZpEipEt6s4cCra8gUzWdaejQ7IPQ4+8S2fJxqvdg3x7eaqD46WiZAdMOzqTL93yoTkJ8LnRWtEOhxDodVBMLfVP1KNLVAW9EBa/41O9zMON9tXE8kUJUn29q58e1hRBvEmu7fIk66PgAEMouzIbfvmCZ6yr5RGPKBilP/BMA3Sucw/6LxNpGwpJMdNk5B4qNByLC6oB61Sk1xwwwq9U3vFtaflT/jF1tcKTsLRgJp3FHpbu+ImDexq5lWHHslLAjqikoTbPCZgMCfQi0RKydfy3dIUB1ThUxyA==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1645383916; bh=cjTFJVmSxDNzXywffJyKNh/veyae9eKDKF+SozjaNe/=;
 h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
 b=BNDaML92riTzXyh4/giUjxcgkjwz8U7fva5GcoVBPEeLDKd1DS/qpvx3g6kHUfC8ywOOyrDPepWmiZcuxQbaUUNi8mFsylZY78l4fuFINXICH+oW7cCxrwOFzU9kTtm+qktviRx01TjlFzhgDDmKdAUsF7hiEvNqjtrv9AgN/xwVgeTmOCRIXDox8L5SPUWmkJve7yOmKtdkDk8ABF1NkwYJLVbolxhkKp46bLivj5Ia4fZCXRJxstGJRYxC0RbpSMQeYbIwlokdxIkDK/e7yfo9/Zc0LgyrgZ7xQLLnivm4kRHG6+lprO6mUhQ/v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f.tIf1Wu0LwxpHji0ir6NZpsgTI9ko3Ck3fVwEpyiQFGk0xu13rgk.aOxRyX65
 HsveXblAae6O69pszRG578Rby6MrNu_8yCT3AoYJXWPKF2TjVNCR1xXt3mO0aEFvmFNFHLVu7bJK
 4LM5Cnq95OIJPdsSSJxm.X1gWC3FDkutiIfCjvUR31Q8HPqawvIaJ2PACS4Wf9Amk1X7j3BCPMms
 sDUvx
X-Sonic-MF: <spacibba@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic303.consmr.mail.bf2.yahoo.com with HTTP; Sun, 20 Feb 2022 19:05:16 +0000
Received: by kubenode509.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP
 Server) with ESMTPA ID a2dee42e35594a6af7d2b6c95d187430; 
 Sun, 20 Feb 2022 19:05:13 +0000 (UTC)
From: Ergus <spacibba@HIDDEN>
Date: Sun, 20 Feb 2022 20:04:31 +0100
Message-ID: <87ley5iclc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
References: <87ley5iclc.fsf.ref@HIDDEN>
X-Mailer: WebService/1.1.19797
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol
Content-Length: 7007
Received-SPF: pass client-ip=74.6.131.42; envelope-from=spacibba@HIDDEN;
 helo=sonic303-3.consmr.mail.bf2.yahoo.com
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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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-Spam-Score: -1.3 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)


Hi:

1)

Recently I have seen that many packages have a pattern where a global
minor mode adds a set of keybindings to another (like isearch or
minibuffer). The issue comes when they want to disable the mode, because
sometimes they need to iterate or loop over, and then emacs looses the
previous binding unless they also adds more code to remember it when set
and then bring it back when unset.

So far with nested keymaps this could be solved, but there is not any
clean way to do that; so my request is to extend the new keymap-set to
set keymap without a prefix in another...

The idea is more or less to enable the developers of packages to do
something like:

```
(defvar-keymap my-mode-isearch-map
     ...)

(define-minor-mode my-mode
    :global t
    (if my-mode
        (keymap-set isearch-mode-map <something> my-mode-isearch-map)
      (keymap-unset isearch-mode-map <something>)))
```

With that then could be trivial to implemented something like
use-packages :bind, so

(define-minor-mode my-mode
    :global t
    :keymap (my-mode-map
             :map isearch-mode-map my-mode-isearch-map))


or similar... I am wondering how nobody have requested this before, when
it is a very common issue I find in many packages around.

2)

Something similar happens to some variables that are modified in minor
modes and then should be restored... this forces sometimes to restart
emacs... (for example completion-styles in fido-mode or some hooks that
are always added and then need to be removed... all these is very
mechanic and increases code and sources of errors...).

The best approach for this one is to save the original value in an alist
and assign with a wrapper around setq...  and use a loop when disabling
the mode to restore the original values.... it is not perfect, but works
in many cases...

To restore the original value they check if the current vars's value is
the same that was set (to assert it was not changed latter).

This way if I try fido-mode and I don't like it, then not restart is
needed to assert that completion-styles is what I had before...

Maybe we could consider to add some api for these functionalities...

Does it makes sense??




In GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.31, cairo version 1.17.4)
 of 2022-02-20 built on Ergus
Repository revision: e6f541f2383cf860c6a2d6c8d366c21a3b8de2d0
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --prefix=/home/ergo/.local/ --with-mailutils --with-json
 --with-x-toolkit=gtk3 --with-xft --with-wide-int --with-modules
 --with-cairo --with-harfbuzz --with-native-compilation --with-pgtk'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  electric-pair-mode: t
  global-auto-revert-mode: t
  xclip-mode: t
  flyspell-mode: t
  company-mode: t
  flycheck-mode: t
  diff-hl-margin-mode: t
  composable-mark-mode: t
  composable-mode: t
  repeat-mode: t
  xterm-mouse-mode: t
  my/consult-mode: t
  vertico-mouse-mode: t
  vertico-mode: t
  minibuffer-depth-indicate-mode: t
  winner-mode: t
  save-place-mode: t
  delete-selection-mode: t
  savehist-mode: t
  global-display-fill-column-indicator-mode: t
  display-fill-column-indicator-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  which-key-mode: t
  override-global-mode: t
  eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
~/gits/emacs_clones/composable/composable-mark hides /home/ergo/.config/emacs/elpa/composable-20201024.1458/composable-mark
~/gits/emacs_clones/composable/composable hides /home/ergo/.config/emacs/elpa/composable-20201024.1458/composable
/home/ergo/.config/emacs/elpa/transient-20220216.2303/transient hides /home/ergo/.local/share/emacs/29.0.50/lisp/transient

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media rmc puny
rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config
gnus-util text-property-search time-date mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils vertico-directory
elec-pair autorevert filenotify xclip flyspell-correct flyspell ispell
company-semantic company-template company-capf company flycheck
ansi-color json map find-func dash pcase diff-hl-margin diff-hl-dired
advice dired-x dired dired-loaddefs diff-hl log-view pcvs-util vc-dir
ewoc vc vc-dispatcher diff-mode vertico-repeat cape comp comp-cstr
warnings term/tmux term/xterm xterm init composable composable-mark
repeat xt-mouse simple-16-theme edmacro kmacro vertico-mouse vertico
mb-depth winner ring saveplace delsel savehist
display-fill-column-indicator display-line-numbers diminish which-key
cl-extra help-mode use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core disp-table info ede/auto eieio-base cl-seq eieio seq
subr-x byte-opt bytecomp byte-compile cconv eieio-core cl-macs gv
eieio-loaddefs cl-loaddefs cl-lib tex-site rx slime-autoloads early-init
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget keymap hashtable-print-readable backquote threads
dbusbind inotify dynamic-setting system-font-setting font-render-setting
cairo gtk pgtk lcms2 multi-tty make-network-process native-compile
emacs)

Memory information:
((conses 16 198940 54047)
 (symbols 48 15486 0)
 (strings 32 59909 31324)
 (string-bytes 1 2103818)
 (vectors 16 30201)
 (vector-slots 8 452967 284466)
 (floats 8 109 1121)
 (intervals 56 726 0)
 (buffers 992 11))




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Ergus <spacibba@HIDDEN>
Subject: bug#54074: Acknowledgement (29.0.50; Feature request emacs
 keymap-set and minor-modes)
Message-ID: <handler.54074.B.164538392319254.ack <at> debbugs.gnu.org>
References: <87ley5iclc.fsf@HIDDEN>
X-Gnu-PR-Message: ack 54074
X-Gnu-PR-Package: emacs
Reply-To: 54074 <at> debbugs.gnu.org
Date: Sun, 20 Feb 2022 19:06:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 54074 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
54074: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D54074
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 20 Feb 2022 19:40:01 +0000
Resent-Message-ID: <handler.54074.B54074.164538596931533 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Ergus <spacibba@HIDDEN>
Cc: 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.164538596931533
          (code B ref 54074); Sun, 20 Feb 2022 19:40:01 +0000
Received: (at 54074) by debbugs.gnu.org; 20 Feb 2022 19:39:29 +0000
Received: from localhost ([127.0.0.1]:33875 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nLs3N-0008CV-Jp
	for submit <at> debbugs.gnu.org; Sun, 20 Feb 2022 14:39:29 -0500
Received: from quimby.gnus.org ([95.216.78.240]:58920)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nLs3K-0008CC-9D
 for 54074 <at> debbugs.gnu.org; Sun, 20 Feb 2022 14:39:26 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=JrhY11wkuEnqLEnTknlw/M6eVtzzQY6isyiwnbYv1x4=; b=R214Jz6VsYUSHltmrdhzbOSyXY
 kaO/3YcLXUeZ5mq0VARCOBoWeVCQmA1GYXslpBgtSD4+qoTOx2TYxGdcwqtvxietfIaBMkrngAM/K
 7qt/2N76J13sfZm0ZvP3DK3Lk6aSBTx75KFSEAuDeQMRhAeBhLADFXj+toWs4boAkfFA=;
Received: from [84.212.220.105] (helo=giant)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1nLs3B-0005co-5v; Sun, 20 Feb 2022 20:39:20 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
X-Now-Playing: DJ Screw's _All Work, No Play_: "DJ Screw  B-Legit  Lil Keke
 Phaz  Duke Screw Mix  feat  B-Legit  Lil Keke  Phaz  Duke "
Date: Sun, 20 Feb 2022 20:39:16 +0100
In-Reply-To: <87ley5iclc.fsf@HIDDEN> (Ergus's message of "Sun, 20 Feb 2022
 20:04:31 +0100")
Message-ID: <87czjhmior.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Ergus <spacibba@HIDDEN> writes: > Recently I have seen that
 many packages have a pattern where a global > minor mode adds a set of
 keybindings
 to another (like isearch or > minibuffer). The issue comes when they want
 to disable the [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ergus <spacibba@HIDDEN> writes:

> Recently I have seen that many packages have a pattern where a global
> minor mode adds a set of keybindings to another (like isearch or
> minibuffer). The issue comes when they want to disable the mode, because
> sometimes they need to iterate or loop over, and then emacs looses the
> previous binding unless they also adds more code to remember it when set
> and then bring it back when unset.

I'm not sure I understand the use case.  Isn't the way to do this just
to have my-mode add itself to isearch-mode-hook, and then have my-mode
have a minor mode keymap with the prefix it uses?

> Something similar happens to some variables that are modified in minor
> modes and then should be restored... this forces sometimes to restart
> emacs... (for example completion-styles in fido-mode or some hooks that
> are always added and then need to be removed... all these is very
> mechanic and increases code and sources of errors...).
>
> The best approach for this one is to save the original value in an alist
> and assign with a wrapper around setq...  and use a loop when disabling
> the mode to restore the original values.... it is not perfect, but works
> in many cases...

I don't think there's any general mechanism that's possible for this.
Any package may mogrify any variable (destructively or not), and only
the package can know what it has to do to bring things back to normal
when the package is switched off.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Ergus <spacibba@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 20 Feb 2022 21:19:01 +0000
Resent-Message-ID: <handler.54074.B54074.164539190610503 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.164539190610503
          (code B ref 54074); Sun, 20 Feb 2022 21:19:01 +0000
Received: (at 54074) by debbugs.gnu.org; 20 Feb 2022 21:18:26 +0000
Received: from localhost ([127.0.0.1]:34000 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nLtb8-0002jL-Ir
	for submit <at> debbugs.gnu.org; Sun, 20 Feb 2022 16:18:26 -0500
Received: from sonic307-2.consmr.mail.bf2.yahoo.com ([74.6.134.41]:42520)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <spacibba@HIDDEN>) id 1nLtb6-0002j7-TT
 for 54074 <at> debbugs.gnu.org; Sun, 20 Feb 2022 16:18:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
 t=1645391898; bh=5j2O15tY3+ffk4t/DM56Zw+A90BcoREvSXAwZJa3GVM=;
 h=Date:From:To:CC:Subject:In-Reply-To:References:From:Subject:Reply-To;
 b=LBi5oKBew1X+PEajTwqe6TPguR/A0ZkGPiMx1Ku243NIxrxhXE0ZcEVCoI65TTHxePNYr1OS8bWOOCOAVhBbT8sCu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E
 0avu4GdtiDrO63wKgUW2BTZmnhhkjZPuiU8UqsfW.uty317L7XHa_WKAEzFHSBZjrYDzGEtQRIzc
 FsrZADYun1YiU46GA94HfNVV7ObEbYYlvE5yqHBw5gNhLpNcdXyI.hmmx4uHnOfXfQ8GeOc.QbIx
 9IW52SERn2wloYA91K75LS9xZ8Ait4LZv_hoRhJ2b.gP2XdLZKHbWA.k4zWvFc1UNU69H6ok7cxx
 v_e5TA3VoZ33zb6fjHJlmRPkQVxgpypsRCk5WeMBEOANR.UWMbIL0HFuXwasubxnoEkNaldd9HNd
 Sv405kkvQWPQn69sLz90BfTK8MbQl.nHsMLXquYa150eAJS0LBiL_QNCqYqv8A8rs_jIEsaWI77b
 70GhxxO7fSS.PQqqzsZej.exxAEIzqGjR.tFf9C4PdHYIV6_OnCW798D62gsDxg786BvR_xfGHLQ
 HnVetkxHkew0CZgt6zq6VvX8__SO66uCZgXWWkFDbnuF_XkYiS2iZVyBviGBWPmld8ejD6ce5Xvh
 2AFEu0mpp_qszv0AF6KgDbbQKbYQukgiFcStX5thghkjvEt7jTz31wJilHwlB7NGb7GwzF0mhZVq
 6Vdu4d27gGvtomvZZqnW4l3DQTwtqTSd.ku1WhQ_zQHfqkSXgtzrGUbetX8cJvC2XAzbXHlSRAGO
 MdUe1apjqiDvUMdkS1kAr7DdYKpowUsO2pkIaUjk9ywxl8D1zW_9837Q0pXiL2cJflV1STF9JPUI
 8noMMyfQJ1yMykbhz8UhB8uGKTiB_Mew.wNj2qDPUqglMKIBv1Nf.5YpMFwvxrAZssgoMhN7qtpy
 5EbJ3LF.I9a7PXHRdCTeHT.yEmZDjzUEd.wpRczacmPr4WTiqft88w3xlCN4YkO3NOG_slLmM8HL
 EWIw86CLMNL8QRWBfj58A.Z87SQ--
X-Sonic-MF: <spacibba@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic307.consmr.mail.bf2.yahoo.com with HTTP; Sun, 20 Feb 2022 21:18:18 +0000
Received: by kubenode519.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP
 Server) with ESMTPA ID 1d2e19827e80cb2b80d45cf49d3909a2; 
 Sun, 20 Feb 2022 21:18:13 +0000 (UTC)
Date: Sun, 20 Feb 2022 22:18:07 +0100
From: Ergus <spacibba@HIDDEN>
In-Reply-To: <87czjhmior.fsf@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
 <87czjhmior.fsf@HIDDEN>
Message-ID: <A0CAF061-83A4-414A-A2FA-926703B5F462@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Mailer: WebService/1.1.19797
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol
Content-Length: 2211
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



On February 20, 2022 8:39:16 PM GMT+01:00, Lars Ingebrigtsen <larsi@gnus=
=2Eorg> wrote:
>Ergus <spacibba@aol=2Ecom> writes:
>
>> Recently I have seen that many packages have a pattern where a global
>> minor mode adds a set of keybindings to another (like isearch or
>> minibuffer)=2E The issue comes when they want to disable the mode, beca=
use
>> sometimes they need to iterate or loop over, and then emacs looses the
>> previous binding unless they also adds more code to remember it when se=
t
>> and then bring it back when unset=2E
>
>I'm not sure I understand the use case=2E  Isn't the way to do this just
>to have my-mode add itself to isearch-mode-hook, and then have my-mode
>have a minor mode keymap with the prefix it uses?
>

Actually the mode does not need to be only for isearch-mode=2E=2E=2E It ca=
n be a global mode that adds multiple other stuff + some extra search comma=
nds=2E=2E=2E It only needs to be enabled once=2E=2E=2E And in general there=
 is not any reason to force it's keys to add an extra prefix=2E=2E=2E

Adding 1 command to isearch-mode-map is fine=2E=2E=2E Suppose we need to a=
dd 5=2E=2E=2E Then it is easier to have a map and add it inline to isearch-=
mode-map=2E=2E=2E




>> Something similar happens to some variables that are modified in minor
>> modes and then should be restored=2E=2E=2E this forces sometimes to res=
tart
>> emacs=2E=2E=2E (for example completion-styles in fido-mode or some hook=
s that
>> are always added and then need to be removed=2E=2E=2E all these is very
>> mechanic and increases code and sources of errors=2E=2E=2E)=2E
>>
>> The best approach for this one is to save the original value in an alis=
t
>> and assign with a wrapper around setq=2E=2E=2E  and use a loop when dis=
abling
>> the mode to restore the original values=2E=2E=2E=2E it is not perfect, =
but works
>> in many cases=2E=2E=2E
>
>I don't think there's any general mechanism that's possible for this=2E
>Any package may mogrify any variable (destructively or not), and only
>the package can know what it has to do to bring things back to normal
>when the package is switched off=2E
>

--=20
Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Ergus <spacibba@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 20 Feb 2022 22:11:02 +0000
Resent-Message-ID: <handler.54074.B54074.164539502415498 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.164539502415498
          (code B ref 54074); Sun, 20 Feb 2022 22:11:02 +0000
Received: (at 54074) by debbugs.gnu.org; 20 Feb 2022 22:10:24 +0000
Received: from localhost ([127.0.0.1]:34076 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nLuPP-00041u-RH
	for submit <at> debbugs.gnu.org; Sun, 20 Feb 2022 17:10:24 -0500
Received: from sonic310-15.consmr.mail.bf2.yahoo.com ([74.6.135.125]:41137)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <spacibba@HIDDEN>) id 1nLuPN-00041h-Nv
 for 54074 <at> debbugs.gnu.org; Sun, 20 Feb 2022 17:10:22 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
 t=1645395016; bh=6Mu0cQxkQCGt7vVBpfLQdMOUfUh2X6F7krxyemkwEYU=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To;
 b=UqJGPIYCo67hLc9EJedWhdSgrAoFMqly28BI5fHkuE2dOEBRAZkmLDN/2X5Atf75LgmLLdyQp4JDUCGTt+dU/tva7ggj56HCkzpXqiBMwqegBCA4TLDkYQbJrIkYh8ApS4yTlM/ufF1YsjA75VDY03Dh5vmrSv55BWLbobPSSLiEOliiniOlms+21iapeWLHcuGEiLboKdV/jtnSXnkEuTLrbqy9aIMBH8o5nLvWyrRGbgXplkRGn6su5Q4/C6mpBdsvbSLVZxX3uvn/r6+u+w7Ah2I1pVnoN2lqCIjt7d0ssyNWJpKdHIq7rdIx5++Tv6EeH0PclxZNBNTCyXJD0g==
X-SONIC-DKIM-SIGN: v=1; a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roVemKrMqydJQJ6J
 721l_Jnf3KtJFhFCzo5hB9yvCbdjK0IUs3DK4bmzcn7XKgfVeMlr72t19U_HabucBCXpaBlNMJWt
 RoB1m4E3ky2caULM1cAnEBN5FJHDLGPB.yYxYe7MFe1pijpNPtEkhQOKNG1QDTQ8i4WiHDvgD4Sa
 CQPS.MYsgbZKrvk3StVwxynyfvhcCEFqzQX6YlPb2THHug2pXBhfWmiRmiNQ34mdpA.4fIehusFV
 T4SuNW.1CGRfpuF9wsz11eoyH3Qhh5JeiVPyKZe.4Np4nfWqTO4uhtTpkHStDAMvczBCoGYLnT5w
 A06p_WmqOoXE2ydzH2s_MepLvQhs.W1xCqlTLKm0.uNWnpvL.Hls_HFo2akxy9TynLOrBdxMpe9u
 5cR_8NTW9pjw3kbFPzEWdOPSdUTX8eaS952FGuuxXQxAAvnV4f59AgUl7fZEN4U75u6jKzd324IG
 53o33Tq918w69GiCmNvQLOJXTXODO1ZB0BlN46E4lz.yhFjFDZtmE_yHLJ6YdfLoQTDEoDpNCFhO
 X5xJFLztXLuf1LaxYaSXfxTBFyIRFxIB9d7hahDDlmg_GlzLm0gac0Qqz5NypH2LLcgLBTTAq1Hv
 Jt2_8XvXlgSREmbeXcps-
X-Sonic-MF: <spacibba@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic310.consmr.mail.bf2.yahoo.com with HTTP; Sun, 20 Feb 2022 22:10:16 +0000
Received: by kubenode501.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP
 Server) with ESMTPA ID 21f7059d869fe736bd5b775abc1bbdd2; 
 Sun, 20 Feb 2022 22:10:10 +0000 (UTC)
Date: Sun, 20 Feb 2022 23:09:31 +0100
From: Ergus <spacibba@HIDDEN>
Message-ID: <20220220220931.524xf6jeihqkhay3@Ergus>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
 <87czjhmior.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <87czjhmior.fsf@HIDDEN>
X-Mailer: WebService/1.1.19797
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol
Content-Length: 2610
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sun, Feb 20, 2022 at 08:39:16PM +0100, Lars Ingebrigtsen wrote:
>Ergus <spacibba@HIDDEN> writes:
>
>> Recently I have seen that many packages have a pattern where a global
>> minor mode adds a set of keybindings to another (like isearch or
>> minibuffer). The issue comes when they want to disable the mode, because
>> sometimes they need to iterate or loop over, and then emacs looses the
>> previous binding unless they also adds more code to remember it when set
>> and then bring it back when unset.

Hi Lars.. thanks for replying!

>
>I'm not sure I understand the use case.  Isn't the way to do this just
>to have my-mode add itself to isearch-mode-hook, and then have my-mode
>have a minor mode keymap with the prefix it uses?
>
Yes this is actually the common way to do it, but it is cumbersome with
no reason for simpler cases... and when more than one keymap can be
affected.

Basically I mean to have a way to add an entry: (keymap …) to another...

Because from the manual:

"If an element of a keymap is itself a keymap, it counts as if this inner
keymap were inlined in the outer keymap."

So, simpler cleaner and eventually not needing execute or start a mode
every time in a hook...

Now keymap-set allows to add a command or keymap to a prefix in another,
but not just append a keymap as is with no prefix and then remove it
completely in a clean way...


>> Something similar happens to some variables that are modified in minor
>> modes and then should be restored... this forces sometimes to restart
>> emacs... (for example completion-styles in fido-mode or some hooks that
>> are always added and then need to be removed... all these is very
>> mechanic and increases code and sources of errors...).
>>
>> The best approach for this one is to save the original value in an alist
>> and assign with a wrapper around setq...  and use a loop when disabling
>> the mode to restore the original values.... it is not perfect, but works
>> in many cases...
>
>I don't think there's any general mechanism that's possible for this.
>Any package may mogrify any variable (destructively or not), and only
>the package can know what it has to do to bring things back to normal
>when the package is switched off.
>

The common is just to save and the restore... isn't it the typical idea
behind a mode? Right now the modes cleanup is a source of issues and
code replication here and there for many mechanical thinks like
add-hook/remove-hook, set variable, unset them, and so on... when the
general idea is that all that may follow the same philosophy than
keybindings set-unset...

Best,
Ergus




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: [External] : bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Drew Adams <drew.adams@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 20 Feb 2022 22:35:02 +0000
Resent-Message-ID: <handler.54074.B54074.164539646326381 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Ergus <spacibba@HIDDEN>, "54074 <at> debbugs.gnu.org" <54074 <at> debbugs.gnu.org>
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.164539646326381
          (code B ref 54074); Sun, 20 Feb 2022 22:35:02 +0000
Received: (at 54074) by debbugs.gnu.org; 20 Feb 2022 22:34:23 +0000
Received: from localhost ([127.0.0.1]:34118 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nLumd-0006rR-93
	for submit <at> debbugs.gnu.org; Sun, 20 Feb 2022 17:34:23 -0500
Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:5802)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1nLumb-0006rI-7E
 for 54074 <at> debbugs.gnu.org; Sun, 20 Feb 2022 17:34:21 -0500
Received: from pps.filterd (m0246630.ppops.net [127.0.0.1])
 by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21KA1g90015336; 
 Sun, 20 Feb 2022 22:34:19 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=from : to : subject :
 date : message-id : references : in-reply-to : content-type :
 content-transfer-encoding : mime-version; s=corp-2021-07-09;
 bh=t+x8SC8F7aNmbvEhsAoWTKMFb/PVNybw7Ggt608pH1w=;
 b=FGonyfuL2yEaLnslLQjCgU3Aerb1VVt9ht9mi2+YbrqA0jb3TtMfRvx6f6TdQRAeeKsb
 P9MDMQV0VyeTYMMdUzN6t+sAj+occv2zQD0HUwcnFZH7sw7uQN5RGqC0N/HnCpYyMUR4
 g8HyIA1bnkgyfZpwy0jlxgwJcE7qdvlzHjIlA+nlpRV/x/VjBEq1V23Iic/Ty3td09/R
 qWLp4vHVG67pUKjM6JUh2eWIbWd9Cc2qVxNVfwil9wk8lFGPHlTFR6hzdC+3rOOsXdd8
 7OiAuKXrZ9KxmQxobj9lkJmTFPd6Bvn8+3Uk57LGGnZIG+gx/8bmWUszg2ArwLRbHmAn 1Q== 
Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79])
 by mx0b-00069f02.pphosted.com with ESMTP id 3eapye2jv4-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sun, 20 Feb 2022 22:34:18 +0000
Received: from pps.filterd (userp3020.oracle.com [127.0.0.1])
 by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21KMUReJ188413;
 Sun, 20 Feb 2022 22:34:12 GMT
Received: from nam10-dm6-obe.outbound.protection.outlook.com
 (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104])
 by userp3020.oracle.com with ESMTP id 3eat0jtwuq-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sun, 20 Feb 2022 22:34:12 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=j4o6yzW23qj0qxCywi7fVYBXQQ+6BPRJtsDFFGPXd5P46fCys5WZx+V60Wlv3pwsq1hMi+MDgXeMNhA7g1Zl7RNCuNNTQb1HTPn74tSzQpIoh/41yln57rOJWtL6ZC4tFyEn5y+t85R7uONjnCj7zluz3kdgxJNPxeDvrUjF/OZyKvRs9XyZ1IbTc/llo0s16OlorjugCXQEMzsx2tvTIMx/mBaZx7/wO/8HBAS9Rv3dzWwlQ3BhMrfb9lb169z2h2j4dDS6z+5J05WogGVi7rsX0iU9Ds574zuwA2N85FVnelxmMAI7pVeTO+cE8EdKshYa89T0hfRd3G2fjM72HA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=t+x8SC8F7aNmbvEhsAoWTKMFb/PVNybw7Ggt608pH1w=;
 b=TmufL3ynlb3CV0EG1ZDk7IMcqoIRGz7iutWR2to6w9KltBemb/FPFWQaSVdhS6XKc/U0ez5U8qpVepfQGVSnqhBuu2+RzpyteGtD1WtVlisRbwr1Y5B9AnxsdQyiwUtTflnqmNzYcdJ7IaW02aCSy/8ph5pDtWUeOik5pQqahtwFscBtkOxVm5J3hEhsk3mK6GJ0wLZmnzI1L/st4Xv1i59HnAangGEA0izemfAD/pMEYdr35zF8GH7qR2av65lZVGp5rdIPMVic6VQfPjyM6k4QhwcLuEXITLdiCiv06CWSegp+bRq8xJ9Pqhd/dJos6karotGBB76D9ay9mbqC8Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
 dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=t+x8SC8F7aNmbvEhsAoWTKMFb/PVNybw7Ggt608pH1w=;
 b=gfgg4p60Sinx1qInfQUeQ77z+TJCG1Ijbf9WWi72MTmD9lfppjkFO5SVB0u6q/kt/008Zx99uA9bVZdNw9KBmtxoic7L/XbmjaPbLbnaO7pXAbT8OFOQjGGZ4q75HJCD5PIrq6ecC5cnqvpyJKuYrpQglzPq285IfrveHGiifRs=
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19)
 by BN6PR1001MB2148.namprd10.prod.outlook.com (2603:10b6:405:2f::37)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16; Sun, 20 Feb
 2022 22:34:10 +0000
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::6d28:e29d:4c51:6d04]) by SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::6d28:e29d:4c51:6d04%5]) with mapi id 15.20.4995.027; Sun, 20 Feb 2022
 22:34:10 +0000
From: Drew Adams <drew.adams@HIDDEN>
Thread-Topic: [External] : bug#54074: 29.0.50; Feature request emacs
 keymap-set and minor-modes
Thread-Index: AQHYJoztkmda15WwYECzdRaLrIkJCaydBfmw
Date: Sun, 20 Feb 2022 22:34:10 +0000
Message-ID: <SJ0PR10MB5488D00B72D646C3B882813EF3399@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
In-Reply-To: <87ley5iclc.fsf@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: b996717d-92b0-455b-bf65-08d9f4c11d35
x-ms-traffictypediagnostic: BN6PR1001MB2148:EE_
x-microsoft-antispam-prvs: <BN6PR1001MB21489B1453FA4404FC67DE8FF3399@HIDDEN>
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: cUPlqhfbKMuvLBg3LxBEhdXZBoK8JdWGe6SH3cUqJuTju2J400vgu4cLUGBFf0x/3YSLkYxAci25Sarh1c+OltSyiubi88xGGodoTzM7Uxoev773Tash3fsRAc1/5J8D8lHL3AjouE5QjbG/L7v531Gn8+qUqBhOD9TZFSBQNgkD4T2uGRwhO8mhme7zg+SeYeYIq18UuwUl6aXRVU47n5NbIVTuF6ArBcTF1qU94vU5PZ2mbtCoC+ZVhNdDPNvCQv/kOka1ko05psjKHULSLCcSwPC0He6eOkiDDb0mCzGD4pkgP0ddMWGkgKpIBRfFTRsbMLuwyIEI3eqlfPWbJoc6cPxQl36/2g2zxK2knNetlWgokzP2i5NWmWr7xYzgQfaSCqfsmRyE+zEXiIh2zakC+HNuTQRLnHzeEoaDQPqDOQPTrg1xoA4asw0dCR/Y3uvzxhWnEMWFYd5g/9q41r9+uDU90Mx44HmYxcGH+iuTtlK2u48zLn0lD9jRpvMZR5NZ74a8YhEnttG9rGDlWarRW0GYi5B3fdANdD1wTNUObIEXA+vlj4HFB3rN1WOLNUMFUabvyePI9HZs6HE7tfETYfi+cCG287rKKa/J29ls4fc3HuF5yH6GuG4MdcmUs5iQTqwSBkGhfQn03/IJ+Cz4TkjGgZd93FHCEgQw2nPFW60F0kCXNIzxXapuTqkRq4FZK1yYKQbqjc+zMPrMIw==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230001)(366004)(55016003)(76116006)(38070700005)(86362001)(2906002)(38100700002)(71200400001)(33656002)(508600001)(66446008)(66476007)(6506007)(7696005)(8676002)(66556008)(44832011)(64756008)(66946007)(4744005)(52536014)(9686003)(316002)(83380400001)(8936002)(26005)(5660300002)(186003)(122000001)(110136005);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: 7qmyywEm7EX369yale/Yvvn4xQKsf3mIaTCX11A2a8PPvv575deMp6blHe4a4fRLIxykvYWLd+1F0+wT82kIa1ZJye7KBUwiU5RtW6xwlw8wz/VI5AeRHjeAfivp9hSqPZYAhsfpD8EIr++kqfhx2zGtKdq29NgFIJTV4+ttsHWvz6dO3gaNtUfdvFUR3JBA6e5cGi1GN7LqbXMd6YgVt7Vob7uacaB4xSDBuCeH2CLJmhTN+WDrO1v71ih2YevwbeS7t4vFvYOW4YizR76MkPWsA4SzeerBKjHUK2yEsbur4Vh9TUF/mh/MJrpf6bux+LGdxhJNam9qI8D/fYt7bjvsX7wxBay1WHROgKhGHs2or2mi1flWgTh9ilc52z0GbNNsm8klSCNVIs9n1o4zUYtutxO4wZcBwmzKExbnTLkDURq2J/2SCuO4xqO0iM1D+UOA96c/Vhvp0rq+FCrODHjJXRWOOmPiTDEN0oC7ws1iwmI5MfaI6ACSAxoSXQxIMNKjRhnz2JzYY43pHlffQ/LpYDauI3uGZcZQa4YWsOSXftv7OFjgKV0bDhJzQrWgbwjEogxc4gnZTjsbLCXvFze+FcQpYw21Hj2s5tnjLbtbrpIPVyzYN+HQJDa71J284S+otKovDg0HTJjaBFeguClC6oOw113Zt9jM3dl36I4sdZIAzRnaf4ZeblZjDyHB7aZPqSWDucQusDKjjMnb/0/+3KZKd1dYWJQZuUpP1HXBNjPOJJaOgQDq0Zk3QJQaO6SpHiH3MTSeNdDYcnfUZLsZo0kcpykwnp2Fn1t7eO4SAs91sc2hgYdKvnvBmtnqqAZTd6J/arNuhw9eQdbeLwhlS33XgUbrmUYW+tIoHvmSsyefxTzTz2DGHAgP2F+G31hQaVSMOsUWofwFP7q4A2ysMSYfaDrnRfBtIvtyDwz9pvrUTthro1Tc05vB7svgID+B8qPBiESyI+sPoonTJoP9bEnYBfUa1cMxm1KqysDe1QnQntoxvedBk5domBr4luNxZTiz63fc0u52ibxsdpJHWz0z65gm4kG9gLiZ/QTjxMOKI4/yHJByIIljsGFCwRKIN7qceWrzIxijwQIaznnE3GAo2DHx4yAtGkTVrzv6Iw/rdnEwKlXgpt5GKcHPK3KUthpbS3q/tUwdK3k4JmQ2XBR108MY9QyDyXnxcDyfYcpCCIulVkRh8NcbR2s/ycZzAiRGkPy8Iq5A5nFZbEGGdmlMRpFV3VXXpTb9gqyJwMS+xdbP6ftpqT/baBGsiVJ2IEdPOmfZoqABv0aHtQRTz7jTyvvN+WRO9nIJuBOgK2n0Kfo2xe82Avk+9+N19HlXjJvDaDJRIOCQOn7SJrDCRYH6CtK++YoHgIWFZhUAY3Vej50H8oTivC3uBubCPOYfNKb5axbm8cSOrtqed1s4T3LKKDHSSDNXE6NtUuxyyRCd+3QLwLhlQih7r8arqkTsM7wEyzA4eagv44+gi9UycAfZw71ktRk/PJNwtOwblUh9Js1s41hXKxDBXInJ8AFc+KMpUMB2MZmMeK5Q0AIR7KCIvy1K+RdK9zabhRt+0UjUcxbyQd4Vu8dkd2n4YiMrcDGx2i964f+ZcRsp2w==
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: b996717d-92b0-455b-bf65-08d9f4c11d35
X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Feb 2022 22:34:10.3220 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 0F/hgD7hgEoYCPcXX8m0X3d2TAl6FYw5IkiWDEuvLs4cVbOL0hbtjP48NsDVU61WGqiWeBea3sQCbcwbQbDTQw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1001MB2148
X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10264
 signatures=677614
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0
 bulkscore=0 spamscore=0
 mlxscore=0 adultscore=0 mlxlogscore=700 suspectscore=0 malwarescore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000
 definitions=main-2202200146
X-Proofpoint-ORIG-GUID: qZ52GhwlJ1MQNt2hPXnc4gbgES2OxFRB
X-Proofpoint-GUID: qZ52GhwlJ1MQNt2hPXnc4gbgES2OxFRB
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

FWIW, in Icicles I save the bindings before
`icicle-mode' (minor mode) is turned on, and
restore them when it is later turned off.

(I do the same for some functions I redefine.
The same can be done with adding and removing
advice.)

However, bindings that something or someone
makes in the interim are of course not taken
into consideration.  That is, what's restored
is the state before `icicle-mode' was turned on.

I don't think there's a great general solution.
No way to know what something or someone really
might want, for example.





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 21 Feb 2022 08:37:02 +0000
Resent-Message-ID: <handler.54074.B54074.1645432574676 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Ergus <spacibba@HIDDEN>
Cc: 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.1645432574676
          (code B ref 54074); Mon, 21 Feb 2022 08:37:02 +0000
Received: (at 54074) by debbugs.gnu.org; 21 Feb 2022 08:36:14 +0000
Received: from localhost ([127.0.0.1]:34980 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nM4B4-0000Aq-Hc
	for submit <at> debbugs.gnu.org; Mon, 21 Feb 2022 03:36:14 -0500
Received: from relay11.mail.gandi.net ([217.70.178.231]:53113)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1nM4B2-0000Aa-Tf
 for 54074 <at> debbugs.gnu.org; Mon, 21 Feb 2022 03:36:13 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 99601100002;
 Mon, 21 Feb 2022 08:36:05 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
Organization: LINKOV.NET
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
Date: Mon, 21 Feb 2022 10:28:07 +0200
In-Reply-To: <87ley5iclc.fsf@HIDDEN> (Ergus via's message of "Sun, 20 Feb
 2022 20:04:31 +0100")
Message-ID: <86zgmkk5tk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> 1)
>
> With that then could be trivial to implemented something like
> use-packages :bind, so
>
> (define-minor-mode my-mode
>     :global t
>     :keymap (my-mode-map
>              :map isearch-mode-map my-mode-isearch-map))
>
>
> or similar... I am wondering how nobody have requested this before, when
> it is a very common issue I find in many packages around.

You might be interested in how the composite keymaps are defined here:

```
(define-minor-mode outline-minor-mode
  :keymap (easy-mmode-define-keymap
           `(([menu-bar] . ,outline-minor-mode-menu-bar-map)
             (,outline-minor-mode-prefix . ,outline-mode-prefix-map))
           :inherit outline-minor-mode-cycle-map)
```

Maybe such keymap definitions could be simplified.

> 2)
>
> The best approach for this one is to save the original value in an alist
> and assign with a wrapper around setq...  and use a loop when disabling
> the mode to restore the original values.... it is not perfect, but works
> in many cases...
> [...]
> Does it makes sense??

Yes, this makes sense.  We used the functions copied below
until you proposed to move keybindings to context-menu-mode-map:

```
(defvar context-menu--saved-bindings nil
  "Alist of bindings to restore when `context-menu-mode' is disabled.")

(defun context-menu--bind-mouse (click-sym down-sym)
  "Enable `context-menu-mode' mouse bindings.
CLICK-SYM and DOWN-SYM are the mouse click and down key symbols to use."
  (let ((click (vector click-sym))
        (down (vector down-sym)))
    (push (cons click-sym (global-key-binding click))
          context-menu--saved-bindings)
    (global-unset-key click)
    (push (cons down-sym (global-key-binding down))
          context-menu--saved-bindings)
    (global-set-key down context-menu-entry)))

(defun context-menu--restore-bindings ()
  "Restore saved `context-menu-mode' bindings."
  (pcase-dolist (`(,sym . ,binding) context-menu--saved-bindings)
    (let ((key (vector sym)))
      (if binding
          (global-set-key key binding)
        (global-unset-key key)))))
```




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: [External] : bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 21 Feb 2022 21:06:01 +0000
Resent-Message-ID: <handler.54074.B54074.164547755232054 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Drew Adams <drew.adams@HIDDEN>
Cc: Ergus <spacibba@HIDDEN>, "54074 <at> debbugs.gnu.org" <54074 <at> debbugs.gnu.org>
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.164547755232054
          (code B ref 54074); Mon, 21 Feb 2022 21:06:01 +0000
Received: (at 54074) by debbugs.gnu.org; 21 Feb 2022 21:05:52 +0000
Received: from localhost ([127.0.0.1]:39295 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMFsV-0008Kw-Se
	for submit <at> debbugs.gnu.org; Mon, 21 Feb 2022 16:05:52 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54918)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1nMFsS-0008Ki-Ne
 for 54074 <at> debbugs.gnu.org; Mon, 21 Feb 2022 16:05:49 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3D6378005E;
 Mon, 21 Feb 2022 16:05:42 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C94A4800A5;
 Mon, 21 Feb 2022 16:05:40 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1645477540;
 bh=1NqCIf6l/k6mHDYMkqjmwuaaTnwOe6D36WHtRGdx/cc=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=h54bQ9yO18RJ48LvMOrIFTqS5w7ohx47ffVxDUfYJ3C5CSagTScCVZVWzOA84IOxl
 0v+9lMmnmXWx6KZ8pN3yLvu6aWFhiz+mo9xFKzE/Z4haFskaGNm9EEd/9Ncw/H8K8m
 dSSe7AHv8oJkmF4kMf3l8ybYJ09LsgDQUwlcOsyQAoeHdD/XO/ehS4Ejlclt6rPcG4
 Uhi59HTewVkRYAdu4Srz8ZmnpzJVZtc/9J0L4NiG3iKMIAWk+JysM9vjrhGy4vGsMz
 ZPwQgPmN2Leyj51A04n3ViYlUoz/xChjaVhvTCQjW82sJtp6yutZxLJSiXdEfvILXm
 5RDZF3aWImj/w==
Received: from pastel (unknown [45.72.197.68])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 763DF120DD4;
 Mon, 21 Feb 2022 16:05:40 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
Message-ID: <jwvh78skk3f.fsf-monnier+emacs@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
 <SJ0PR10MB5488D00B72D646C3B882813EF3399@HIDDEN>
Date: Mon, 21 Feb 2022 16:05:38 -0500
In-Reply-To: <SJ0PR10MB5488D00B72D646C3B882813EF3399@HIDDEN>
 (Drew Adams's message of "Sun, 20 Feb 2022 22:34:10 +0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.059 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> However, bindings that something or someone
> makes in the interim are of course not taken
> into consideration.

That's the problem with the naive approach, indeed (in addition to the
need to write the code).

> I don't think there's a great general solution.  No way to know what
> something or someone really might want, for example.

In his example, the minor mode just adds the keymap and then removes it,
so it doesn't interact unduly with other changes that might take place
in the mean time.


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 21 Feb 2022 21:23:02 +0000
Resent-Message-ID: <handler.54074.B54074.16454785541204 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: Ergus <spacibba@HIDDEN>, 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.16454785541204
          (code B ref 54074); Mon, 21 Feb 2022 21:23:02 +0000
Received: (at 54074) by debbugs.gnu.org; 21 Feb 2022 21:22:34 +0000
Received: from localhost ([127.0.0.1]:39320 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMG8f-0000JM-UI
	for submit <at> debbugs.gnu.org; Mon, 21 Feb 2022 16:22:34 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:11000)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1nMG8d-0000J5-JA
 for 54074 <at> debbugs.gnu.org; Mon, 21 Feb 2022 16:22:32 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9F6A9805B1;
 Mon, 21 Feb 2022 16:22:25 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 26F8C800A5;
 Mon, 21 Feb 2022 16:22:24 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1645478544;
 bh=35dzUHLAuajNjOUh+b/DBwGPDwfYSpx+B/i68OdY1FA=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=iNOBLSmtB16w434+VS+CUtFtnelgzC5iAcdqAvWXj4r+uR4ZibbDblJXCen5gcczy
 cGMaG9NXmiHqd2GjjnVWg7UkNWtoRFAUBZzpnSB5rhByYCXrhUrDG6UtP6G0I+30Ka
 /yuaLxh9oZ05RD68sUowDj5V9lQf+H5x3jv/7ke04RV92wpY3YzVNYCCmZ6vFSQHe8
 VJq2UPaGIPQgSmkET7p2veiqTvJVtDQY0WOE5s51Ym6x+/H6aO4V6NWE71HHfUndQb
 dr72+so7KzMy8m1AppyGiy1frbUE2D1I1CCHdQLwbzKpzNFh/eKGkP3eSgbKDlm19F
 vUuzUP2v2zugg==
Received: from pastel (unknown [45.72.197.68])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E47EF120F08;
 Mon, 21 Feb 2022 16:22:23 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
Message-ID: <jwvbkz0kjyv.fsf-monnier+emacs@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
 <87czjhmior.fsf@HIDDEN>
Date: Mon, 21 Feb 2022 16:22:23 -0500
In-Reply-To: <87czjhmior.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sun,
 20 Feb 2022 20:39:16 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.059 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> Recently I have seen that many packages have a pattern where a global
>> minor mode adds a set of keybindings to another (like isearch or
>> minibuffer). The issue comes when they want to disable the mode, because
>> sometimes they need to iterate or loop over, and then emacs looses the
>> previous binding unless they also adds more code to remember it when set
>> and then bring it back when unset.
> I'm not sure I understand the use case.  Isn't the way to do this just
> to have my-mode add itself to isearch-mode-hook, and then have my-mode
> have a minor mode keymap with the prefix it uses?

I think the use case is basically any minor mode which currently uses
`define-key` in its body to modify some other package's keymap.

> I don't think there's any general mechanism that's possible for this.
> Any package may mogrify any variable (destructively or not), and only
> the package can know what it has to do to bring things back to normal
> when the package is switched off.

I think we should provide an API to do that meaningfully.  I.e. instead
of having a minor mode just bluntly set a variable, associate with each
global var a pair (VAL . FUNS) of a base value and a list of functions,
where the effective value (the one that should be stored in the
`symbol-value`, barring intervention from code that disregards the new
API) is (FUN1 (FUN2 (... VAL))).

The minor mode can then add/remove a function from the list, and just as
is the case with `add-hook`, `add-function`, etc... it will correctly
handle the case where the additions/removals are not nested.


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 22 Feb 2022 13:24:02 +0000
Resent-Message-ID: <handler.54074.B54074.164553619018211 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>
Cc: Ergus <spacibba@HIDDEN>, 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.164553619018211
          (code B ref 54074); Tue, 22 Feb 2022 13:24:02 +0000
Received: (at 54074) by debbugs.gnu.org; 22 Feb 2022 13:23:10 +0000
Received: from localhost ([127.0.0.1]:40299 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMV8B-0004jW-8K
	for submit <at> debbugs.gnu.org; Tue, 22 Feb 2022 08:23:10 -0500
Received: from quimby.gnus.org ([95.216.78.240]:51158)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nMV8A-0004ip-29
 for 54074 <at> debbugs.gnu.org; Tue, 22 Feb 2022 08:23:02 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=j5lthXz8OprY/DS3XSO+7FlvBysgQhDkFQfnrEBlkiY=; b=MR4RZpoREjZg28V8OytnNRSYRh
 zQ5RFtuPzJrsizg8BkePA0FO/kgw5aoymf7uaYS2en483+L3kFddaZOwn5H3X8+Wirpihxumt1XUs
 0On99y/A+Hc8DDS/s15K3BFJz3JCmXpTL0Afpd6ttj0s6uekyfiUyI2ae3umsEOUyoAM=;
Received: from [84.212.220.105] (helo=giant)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1nMV80-0005e6-Gj; Tue, 22 Feb 2022 14:22:55 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
 <87czjhmior.fsf@HIDDEN> <jwvbkz0kjyv.fsf-monnier+emacs@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEW0pIzo07P34L34
 5MTbyKqXindUS0T/////d/kTAAAAAWJLR0QHFmGI6wAAAAd0SU1FB+YCFg0LO1lcqqAAAAG7SURB
 VDjLdZRBcsMwCEU900n3EC5gJSewcwFcpets5HU39v2P0A9IcpO2rCQ9IfiAPQyciFNK84sNBtJv
 mwy8Gk4u/wJ7irpJbuYxsFXfLfcCG4ZTKfPkQAAkK9+3vazlUTrAqZDK8rm7raVMBgivKBzy+fQe
 ZG8euG0+yTxWAw8Ho8JBkNQBwmOMXDWAoy8Dy9hkcA2+79szONfY675NB5AD7AF0VJybwEsFWwNZ
 1WpCfELcreyleLoBoCNzL6KiiA88BSGolyZovObMzDP6AVCviXXm6g5pNkBZqw4ApMg8cjxFrYnS
 pTroDWTxnqlUkKODECJqLVNU7fYBYNeQFe7hOHzT7S2A3UdDKABjSOYG/KlRKJbnBsinoSsnvgRA
 c+2tBlCDmpV68Lw0kJeWruVrAiqg86UBzImXOEIIHx4meqFY0qHcVIjGFKNEPTicLUiddgzS8ZSo
 V8pzRXE8eE0KUsjmHksKgTV1+IRAIHyU+HBiQ7aXkJOtcQE8T0qSYy5kacDCWz96PIBHrTkqvgD6
 YzYvFfjWdYRXA+oTkTDaUj+VAHZoM/XzL2CgztqzGdA/AD979P8Q8TcQI9y9ApBXFwAAACV0RVh0
 ZGF0ZTpjcmVhdGUAMjAyMi0wMi0yMlQxMzoxMTo1OSswMDowMNYVbtYAAAAldEVYdGRhdGU6bW9k
 aWZ5ADIwMjItMDItMjJUMTM6MTE6NTkrMDA6MDCnSNZqAAAAAElFTkSuQmCC
X-Now-Playing: Cannon's Jug Stompers's _Anthology of American Folk Music:
 Songs (1)_: "Minglewood Blues"
Date: Tue, 22 Feb 2022 14:22:49 +0100
In-Reply-To: <jwvbkz0kjyv.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Mon, 21 Feb 2022 16:22:23 -0500")
Message-ID: <87fsobc9xy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Stefan Monnier <monnier@HIDDEN> writes: >> I'm not
 sure I understand the use case. Isn't the way to do this just >> to have
 my-mode add itself to isearch-mode-hook, and then have my-mode >> have a minor
 mode keymap with the prefix it uses? [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Stefan Monnier <monnier@HIDDEN> writes:

>> I'm not sure I understand the use case.  Isn't the way to do this just
>> to have my-mode add itself to isearch-mode-hook, and then have my-mode
>> have a minor mode keymap with the prefix it uses?
>
> I think the use case is basically any minor mode which currently uses
> `define-key` in its body to modify some other package's keymap.

But why do that instead of using a minor mode?  I think many cases where
packages do this, it's because the idea didn't really occur to the
people that did the implementation.

> I think we should provide an API to do that meaningfully.  I.e. instead
> of having a minor mode just bluntly set a variable, associate with each
> global var a pair (VAL . FUNS) of a base value and a list of functions,
> where the effective value (the one that should be stored in the
> `symbol-value`, barring intervention from code that disregards the new
> API) is (FUN1 (FUN2 (... VAL))).

As Eli noted, isn't this kinda `add-variable-watcher'?  But:

> The minor mode can then add/remove a function from the list, and just as
> is the case with `add-hook`, `add-function`, etc... it will correctly
> handle the case where the additions/removals are not nested.

My feeling is that this would be both too complicated for most people
writing modes, and it would be really confusing for us people that have
to try to figure out what's actually going on, and finally, values in
Emacs Lisp are mutable, so it won't work reliably anyway.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 22 Feb 2022 14:08:01 +0000
Resent-Message-ID: <handler.54074.B54074.164553883331690 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: Ergus <spacibba@HIDDEN>, 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.164553883331690
          (code B ref 54074); Tue, 22 Feb 2022 14:08:01 +0000
Received: (at 54074) by debbugs.gnu.org; 22 Feb 2022 14:07:13 +0000
Received: from localhost ([127.0.0.1]:40490 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMVov-0008F4-8Y
	for submit <at> debbugs.gnu.org; Tue, 22 Feb 2022 09:07:13 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54132)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1nMVot-0008En-MF
 for 54074 <at> debbugs.gnu.org; Tue, 22 Feb 2022 09:07:12 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 9CD3E1000D2;
 Tue, 22 Feb 2022 09:07:05 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0571B1001D2;
 Tue, 22 Feb 2022 09:07:04 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1645538824;
 bh=XmOq5iysKtzBxtWxa/DsjjNL0vjlx3IjFAbYwtDSwnY=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=GiwiZEz8nPzky5s5497fSfLID/cdcPd4oSt78QOyKvrsjCLpKGA8LLkq4YBvoSEZC
 vGYMpJDrd1/EhcLsAR0SLU7UkIkWDruAhZPAYkrkI1pmDR3mEdKz0chi7zjewl/2Ol
 pMeV3vkyLBkS1TUGQthNZb5QQmiMLexkt3TUVZlm2xqXOYvgeXmO1ThZEEjiVX/m/t
 t9eXW9y1iJVrmkFWjjWxo3WUH2IKk0UuesmBGsjSkEGawnstd35GADG0ClHvTQbyJ6
 Ff0dKPhURxFiae5s4GWRvwxw0FeiJeBxn0UnXoVhgIHvny9hlhyVnHr28/WAXFRfAZ
 GEbcmfF3WX98A==
Received: from pastel (unknown [45.72.197.68])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A8AF2120891;
 Tue, 22 Feb 2022 09:07:03 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
Message-ID: <jwv35kbhump.fsf-monnier+emacs@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
 <87czjhmior.fsf@HIDDEN> <jwvbkz0kjyv.fsf-monnier+emacs@HIDDEN>
 <87fsobc9xy.fsf@HIDDEN>
Date: Tue, 22 Feb 2022 09:07:02 -0500
In-Reply-To: <87fsobc9xy.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Tue,
 22 Feb 2022 14:22:49 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.044 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lars Ingebrigtsen [2022-02-22 14:22:49] wrote:
> Stefan Monnier <monnier@HIDDEN> writes:
>>> I'm not sure I understand the use case.  Isn't the way to do this just
>>> to have my-mode add itself to isearch-mode-hook, and then have my-mode
>>> have a minor mode keymap with the prefix it uses?
>> I think the use case is basically any minor mode which currently uses
>> `define-key` in its body to modify some other package's keymap.
> But why do that instead of using a minor mode?

[ I assume you meant "using a minor mode MAP".  ]

E.g. because they don't want the priority that comes with minor mode maps?

> I think many cases where packages do this, it's because the idea
> didn't really occur to the people that did the implementation.

Many, maybe, but definitely not all.

BTW, we currently have related functions to add/remove a keymap from
another: `internal-push/pop-keymap` used by `set-transient-map`.

>> The minor mode can then add/remove a function from the list, and just as
>> is the case with `add-hook`, `add-function`, etc... it will correctly
>> handle the case where the additions/removals are not nested.
> My feeling is that this would be both too complicated for most people
> writing modes, and it would be really confusing for us people that have
> to try to figure out what's actually going on, and finally, values in
> Emacs Lisp are mutable, so it won't work reliably anyway.

W.r.t complexity, it's a worry, indeed.  Until someone implements it and
tries to provide convenient ways to use it (e.g. for minor modes), it's
hard to tell.

W.r.t it being unreliable, it shouldn't be any less reliable than what we
have today, and more importantly any misbehavior could then be fixed by
making the relevant code(s) use the new API, whereas currently there's
basically no way to fix those problems (short of ad-hoc hacks).


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 22 Feb 2022 14:32:02 +0000
Resent-Message-ID: <handler.54074.B54074.16455403218346 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>
Cc: Ergus <spacibba@HIDDEN>, 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.16455403218346
          (code B ref 54074); Tue, 22 Feb 2022 14:32:02 +0000
Received: (at 54074) by debbugs.gnu.org; 22 Feb 2022 14:32:01 +0000
Received: from localhost ([127.0.0.1]:40561 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMWCu-0002AM-Gs
	for submit <at> debbugs.gnu.org; Tue, 22 Feb 2022 09:32:00 -0500
Received: from quimby.gnus.org ([95.216.78.240]:51954)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nMWCs-000242-JY
 for 54074 <at> debbugs.gnu.org; Tue, 22 Feb 2022 09:31:59 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=qdHmeEf6j8JQcqiC0HBrbz5gGduamxNL1+3e9k8OF9c=; b=mwNqr8b1t1URPZMw9uWb9t7U5V
 yWDN4hNyUEdii8aoJ667KAnzlw1lz5cfI74wZgFo75cMPD1o1DuLAhhah/4aN+ASWRTPYNdNgUktp
 ZaJn1Z7cOuRsf4rhzs0ICPZiNmHx7xwxyfThdFeNNH8tNsLK+8aJaal7ebb34Gk2Ojrg=;
Received: from [84.212.220.105] (helo=giant)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1nMWCi-0006S7-23; Tue, 22 Feb 2022 15:31:51 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
 <87czjhmior.fsf@HIDDEN> <jwvbkz0kjyv.fsf-monnier+emacs@HIDDEN>
 <87fsobc9xy.fsf@HIDDEN> <jwv35kbhump.fsf-monnier+emacs@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEVYWl0wJjOkkW20
 qIv///8HqRssAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+YCFg4eFMd+z7QAAAGASURBVDjLbZMBksMg
 CEWBXAB6AgcvkDH3v9t+RI2262y71ZcPXyBERIYPidNaTl6IzUz7lm2cY/vcZAtQ/8dMD1YC41Qw
 mTJxPmZjAVCJXQ/+MlaAqxhDswCIOg5YhLZV3AEkf7b0l0Q8jMU9auy6Mxh092r28VxTQwmQDgG9
 1SeXYEOO7/CRJbmCLdHrnMl3Xx3k0vcwHo4L5vVRFV2gX1WYMl6hViboR1mneF4mGBVEJt0Tz9iq
 oRUvUuAcf9mPqO6wFcCnIkD3paxfoUh5NmwHajrAFHST+fgBPIHG5TNHb5ig1iO5ZmHQ4ijt0ybI
 INAImlEEUzWTRy3iJhg2v68XdKKfaFfzu25gmCaEqociAV+OzpZUYFYO0CpAiRbzJolRqAUi2NUt
 mPbhAYjxOZLUGC0YcDlDWY4bAJ2hrI8inEVy29cV4UGbfIFPCmJ6T6BpKnQniFj0L1BJRTtAv5NS
 /QY6SvqjmEMzFOPFXvPB+kww3p01givHfK124v4H+4lLhm5hgAUAAAAldEVYdGRhdGU6Y3JlYXRl
 ADIwMjItMDItMjJUMTQ6MzA6MTkrMDA6MDCYgrSLAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIyLTAy
 LTIyVDE0OjMwOjE5KzAwOjAw6d8MNwAAAABJRU5ErkJggg==
X-Now-Playing: Nina Simone's _Nina Simone And Her Friends_: "For All We Know"
Date: Tue, 22 Feb 2022 15:31:45 +0100
In-Reply-To: <jwv35kbhump.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 22 Feb 2022 09:07:02 -0500")
Message-ID: <87tucr9dm6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Stefan Monnier <monnier@HIDDEN> writes: > [ I
 assume you meant "using a minor mode MAP". ] Yes. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Stefan Monnier <monnier@HIDDEN> writes:

> [ I assume you meant "using a minor mode MAP".  ]

Yes.

> E.g. because they don't want the priority that comes with minor mode maps?

In what way?

> BTW, we currently have related functions to add/remove a keymap from
> another: `internal-push/pop-keymap` used by `set-transient-map`.

Hm...  right.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 22 Feb 2022 15:40:02 +0000
Resent-Message-ID: <handler.54074.B54074.16455443833302 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: Ergus <spacibba@HIDDEN>, 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.16455443833302
          (code B ref 54074); Tue, 22 Feb 2022 15:40:02 +0000
Received: (at 54074) by debbugs.gnu.org; 22 Feb 2022 15:39:43 +0000
Received: from localhost ([127.0.0.1]:42391 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMXGR-0000rC-Ky
	for submit <at> debbugs.gnu.org; Tue, 22 Feb 2022 10:39:43 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53624)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1nMXGP-0000qx-Dt
 for 54074 <at> debbugs.gnu.org; Tue, 22 Feb 2022 10:39:42 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 40DA144110F;
 Tue, 22 Feb 2022 10:39:35 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E8EA1440C92;
 Tue, 22 Feb 2022 10:39:33 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1645544373;
 bh=vecGzpjk1lbCqk7YvYkJWbg1HqArE0b5sOcwUzy1noA=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=LmWxUUr7BmYOBjMEdoUpF+A09DtIJ6A6ztJsGZw8iwn2TXXEK80rWIpKX8VDuDuxJ
 R9sJIhuWToql5iF0p5AD74s2jbCZhGu76h8+gEcUOgfIh7aDwoKUgsX5iG7h7di3Hi
 PX/ibDTwbjJWfgjI+84w9GIFjmQn3lUNKT6Ct/DsKosviqNQ0e9y3VuhDG8LWWzE3n
 jWJgwqaTqLMHJkB4U+wyBx/DXZAradl4ukiDtwN92Qg/hd6FpTzCMpHzn7O7VQLbYa
 kDDT0AlcEHf01U1E1nd5hX+Wd4fGa4EsW07Ktg705tHe1KL991efe8ioxEzzZpGN80
 gLYZeLBfDax9A==
Received: from pastel (unknown [45.72.197.68])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B7BD6120976;
 Tue, 22 Feb 2022 10:39:33 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
Message-ID: <jwvr17uhq3e.fsf-monnier+emacs@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
 <87czjhmior.fsf@HIDDEN> <jwvbkz0kjyv.fsf-monnier+emacs@HIDDEN>
 <87fsobc9xy.fsf@HIDDEN> <jwv35kbhump.fsf-monnier+emacs@HIDDEN>
 <87tucr9dm6.fsf@HIDDEN>
Date: Tue, 22 Feb 2022 10:39:32 -0500
In-Reply-To: <87tucr9dm6.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Tue,
 22 Feb 2022 15:31:45 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.071 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lars Ingebrigtsen [2022-02-22 15:31:45] wrote:
> Stefan Monnier <monnier@HIDDEN> writes:
>> [ I assume you meant "using a minor mode MAP".  ]
> Yes.
>> E.g. because they don't want the priority that comes with minor mode maps?
> In what way?

E.g. some (typically global) modes want to have lower keymap-priority
than the bindings from major and/or minor modes, so they basically
want to have a priority between the global map and the local map.
The easiest way to do that is to add their bindings to the global map.

>> BTW, we currently have related functions to add/remove a keymap from
>> another: `internal-push/pop-keymap` used by `set-transient-map`.
> Hm...  right.

Are you suggesting that I could occasionally be wrong?
What is this?  A mutiny?


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 23 Feb 2022 12:14:01 +0000
Resent-Message-ID: <handler.54074.B54074.164561839215167 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54074
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>
Cc: Ergus <spacibba@HIDDEN>, 54074 <at> debbugs.gnu.org
Received: via spool by 54074-submit <at> debbugs.gnu.org id=B54074.164561839215167
          (code B ref 54074); Wed, 23 Feb 2022 12:14:01 +0000
Received: (at 54074) by debbugs.gnu.org; 23 Feb 2022 12:13:12 +0000
Received: from localhost ([127.0.0.1]:44130 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMqW8-0003wZ-31
	for submit <at> debbugs.gnu.org; Wed, 23 Feb 2022 07:13:12 -0500
Received: from quimby.gnus.org ([95.216.78.240]:33804)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nMqW6-0003wM-20
 for 54074 <at> debbugs.gnu.org; Wed, 23 Feb 2022 07:13:10 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=MU5L5w4jBJRd40j5Bg5T6AYXNKIytsCiNafnBoHoPEQ=; b=X+50hboCy3WXh0KjHK7fhKGQ9J
 Wtv/CC5/NH7P6GPJHfigZ8zjfXS1ohG06iVeksN/uonzMy7ngXrSy43uppGlFQQ3YEZTe1VK7bEtF
 5gqcmnCqzHaIjfyr02aVRMlUjFawCMEyx3k3iTtjk8qsxdFaz31cwcQRbVVHvYX6+CnU=;
Received: from [84.212.220.105] (helo=giant)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1nMqVw-0001K9-02; Wed, 23 Feb 2022 13:13:03 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <87ley5iclc.fsf.ref@HIDDEN> <87ley5iclc.fsf@HIDDEN>
 <87czjhmior.fsf@HIDDEN> <jwvbkz0kjyv.fsf-monnier+emacs@HIDDEN>
 <87fsobc9xy.fsf@HIDDEN> <jwv35kbhump.fsf-monnier+emacs@HIDDEN>
 <87tucr9dm6.fsf@HIDDEN> <jwvr17uhq3e.fsf-monnier+emacs@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEV9hLKztss+SZwk
 KmT///+HInAoAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+YCFwwBOfTDLlQAAAGcSURBVDjLhZSLseMw
 CEWRXgNyKsBQQaD/3vZesJz47c4smfFYOvzBEWk5fsn662aLLPOYZhbi9Qyj+FsOnAqY4KmzwLRT
 DijylFBLwAIyBy0APDw9E7YFVBqYQzkSIu0qbAP8MgwmHuWBMRogt2AUAsV5g8B7OcnK1vJ/gJfx
 AX4VCP0HQIodo0Erd0cK0P12zaKNhQKsAr7vQ1hn1ZE3YA0XmGxi5AdMAJ4IrMAVFKA1HoBjydm5
 EWR+pem+013xAPmpY6ZO5VyxKzZ1ylQRxTzkfU481zrGmC+M7jUE76hjqKN+gkPnz2lrrAOahy5x
 ORU6Y6hBfYi8Fl0lExVVFRWDW5U1QVeiDralE72ycvYq6rrHcEsDXHG4Gfc9JrhusCWjtmSxzW3x
 zeiqBvAA3qAdPUAtHIH1nvzKqkF+A7d3AUa/Adc3fjYoi/xMhJvYWd096d3PrqNy6pZcMFk51Svn
 3Ssm+ObM690rjHXLEhZH1Fe0N7tb1aAdWX9+tUzoawPPXfzl6Po+aLNjsNEb+AX8AnU6sRr//vf5
 AxNqlRczdUN+AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTAyLTIzVDEyOjAxOjU3KzAwOjAwNFqC
 XwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wMi0yM1QxMjowMTo1NyswMDowMEUHOuMAAAAASUVO
 RK5CYII=
X-Now-Playing: Cat Power's _Covers_: "I'll Be Seeing You"
Date: Wed, 23 Feb 2022 13:12:58 +0100
In-Reply-To: <jwvr17uhq3e.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 22 Feb 2022 10:39:32 -0500")
Message-ID: <871qzt93xx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Stefan Monnier <monnier@HIDDEN> writes: > E.g. some
 (typically global) modes want to have lower keymap-priority > than the
 bindings
 from major and/or minor modes, so they basically > want to have a priority
 between the global map and the lo [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Stefan Monnier <monnier@HIDDEN> writes:

> E.g. some (typically global) modes want to have lower keymap-priority
> than the bindings from major and/or minor modes, so they basically
> want to have a priority between the global map and the local map.
> The easiest way to do that is to add their bindings to the global map.

Ah, yes, that seems to be a valid use case; hadn't thought of that.

>> Hm...  right.
>
> Are you suggesting that I could occasionally be wrong?
> What is this?  A mutiny?

I would never imply anything like that!

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Last modified: Wed, 23 Feb 2022 12:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.