all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Benjamin Andresen <invalid@invalid.invalid>
To: help-gnu-emacs@gnu.org
Subject: I'd like non-overwriteable global keybindings
Date: Wed, 02 Apr 2008 17:04:58 +0200	[thread overview]
Message-ID: <87tziks3fp.fsf@gmail.com> (raw)


Hey there,

I'm trying to set certain keybindings to be global but I don't want
_any_ major or minor mode to be able to change them. One example:

M-o should always be 'other-window

I'd start with (global-set-key (kbd "M-o") 'other-window) and that
works, until there is a major mode that sets it locally.
Example: rcirc overwrites M-o.

I tried several things to get rid of them without specifically setting
rcirc-map locally to nil, because I have several and I just want a
general solution.

What I tried:

(add-hook 'after-change-major-mode-hook
          '(lambda () (define-key (current-local-map) (kbd "M-o")
          'nil)))

This doesn't work. M-o still does rcirc omit mode.
Apparently that's not the very latest hook that is run after a buffer
is initialized. Maybe there is a hook that gets called after every
(use-local-map) or so?

Another hack would be to get a list of all -maps at any given moment and
map through it and run a (define-key mapcmap ...)
Any idea if there is a variable that holds them all?

Two other ways that people on #emacs suggested are creating a minor mode
as some sort of overlay and/or somehow use overriding-local-map.

I haven't investigated the minor mode one, but the overriding-local-map
is neither a function nor a variable if you ask define-key... (both are
void, but documented)

Does anyone have an idea how to fix this or has any other pointers, I
would be very happy.

A general solution is necessary because listing each mode where I want
to continue using my global bindings seems wasteful...

Thanks in advance,
benny







          
          



             reply	other threads:[~2008-04-02 15:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 15:04 Benjamin Andresen [this message]
2008-04-02 17:27 ` I'd like non-overwriteable global keybindings Scott Frazer
2008-04-04 15:12   ` Benjamin Andresen
2008-04-03 14:07 ` Lennart Borgman (gmail)
  -- strict thread matches above, loose matches on Subject: below --
2008-04-03 17:30 martin rudalics

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=87tziks3fp.fsf@gmail.com \
    --to=invalid@invalid.invalid \
    --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.