unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: German Pacenza <germanp82@hotmail.com>
Cc: 64417@debbugs.gnu.org
Subject: bug#64417: 30.0.50; keymap-unset :REMOVE keyword not working
Date: Sun, 02 Jul 2023 12:02:25 -0400	[thread overview]
Message-ID: <jwv7cri8g39.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <DM5PR2201MB1161380C3487424F26D62A61A728A@DM5PR2201MB1161.namprd22.prod.outlook.com> (German Pacenza's message of "Sun, 02 Jul 2023 08:46:28 -0300")

> When I evaluate:
> (keymap-unset diff-mode-map "M-SPC" :REMOVE)
> M-SPC still runs scroll-up-command
>
> (keymap-unset diff-mode-map "M-SPC")
> M-SPC is removed from diff-mode-map and cycle-spacing (global-mode-map)
> is activated
>
> This contradicts the keymap-unset docstring:
>
> If REMOVE, remove the binding instead of unsetting it.  This only
> makes a difference when there’s a parent keymap.  When unsetting
> a key in a child map, it will still shadow the same key in the
> parent keymap.  Removing the binding will allow the key in the
> parent keymap to be used.

Thanks for providing a great example of why the `remove` arg of
`keymap-unset` is a problematic feature :-)

The technical reason for the above: while `diff-mode-map` has no parent,
the keymap bound to ESC in `diff-mode-map` has `diff-mode-shared-map`
as parent, and `M-SPC` is the same (for keymap purposes) as `ESC SPC`.
Of curse, there's no binding of anything to `scroll-up-command` itself
in `diff-mode-shared-map` itself: the binding is to be found in
`diff-mode-shared-map`s parent, `special-mode-map`.

So we can't *remove* the binding from `M-SPC` to `scroll-up-command`
without modifying some other keymap.

So, the code is doing The Right Thing :-(


        Stefan






  parent reply	other threads:[~2023-07-02 16:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-02 11:46 bug#64417: 30.0.50; keymap-unset :REMOVE keyword not working German Pacenza
2023-07-02 12:14 ` Eli Zaretskii
2023-07-02 16:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-07-02 16:54   ` German Pacenza
2023-07-02 21:41     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-02 22:30       ` German Pacenza
2023-09-10  7:34         ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7cri8g39.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=64417@debbugs.gnu.org \
    --cc=germanp82@hotmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).