all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jan Synacek <jsynacek@redhat.com>
To: help-gnu-emacs@gnu.org
Subject: Documentation for overriding-terminal-local-map is confusing?
Date: Mon, 25 May 2020 10:49:47 +0200	[thread overview]
Message-ID: <m6fsgfotn4k.fsf@jsynacek-ntb.brq.redhat.com> (raw)

Hello,

I currently have this piece of elisp in my init.el:
...
(setf jsynacek-terminal-map (make-sparse-keymap))
(setf overriding-terminal-local-map jsynacek-terminal-map)
(define-key jsynacek-terminal-map (kbd "C-b") 'ido-switch-buffer)
(define-key jsynacek-terminal-map (kbd "C-o") 'find-file)
...

It works until I use isearch-forward, which resets
overriding-terminal-local-map. It took me a while to figure out, until I
noticed this in "22.9 Controlling the Active Keymaps" in the ELisp
manual:

"This variable is always local to the current terminal and cannot be
buffer-local.  *Note Multiple Terminals::.  It is used to implement
incremental search mode."

That basically means that the keymap is pretty much useless for
overriding anything, doesn't it? Because it always gets reset whenever
the user starts searching for something. Also, the rest of the manual
that mentions overriding-terminal-local-map kind of suggests that it's
supposed to be used exactly how I wanted to use it - to make one's own
global keybindings that work no matter what the current modes are.

So my questions are:

1) Is this actually a "bug" in the manual? That is, shouldn't the manual
be changed to be clearer? If yes, I can file a bug report.

2) What is the proper way to make my own keymap that overrides
everything? I know that the 'use-package/bind-key' package does this by
creating a minor mode and then using emulation-mode-map-alists, but the
variable's documentation doesn't even remotely suggest to use it that
way.

Regards,
Jan




             reply	other threads:[~2020-05-25  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25  8:49 Jan Synacek [this message]
2020-05-25 14:08 ` Documentation for overriding-terminal-local-map is confusing? Stefan Monnier
2020-05-25 16:38   ` Jan Synacek

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

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

  git send-email \
    --in-reply-to=m6fsgfotn4k.fsf@jsynacek-ntb.brq.redhat.com \
    --to=jsynacek@redhat.com \
    --cc=help-gnu-emacs@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.