10

I'm currently rebinding almost all of my Emacs bindings to fit my new keyboard layout, bépo, a french equivalent of dvorak.

I'm having trouble mapping my ^ key. The ^ key is a dead key but not at a material level.

I'd like to be able to to map C-^ but currently, it don't work. Because "dead-circumflex" and "circumflex" are two different keys.

If I do:

(global-set-key "C-^" 'next-line)

Then, pressing control key with "^" key does the following:

 <C-dead-circumflex> is undefined

We have the proof emacs see the dead-circumflex. But I still can't manage to map it.

I know that I can do

(global-set-key "^" 'next-line)

, and that it will work by pressing ^ twice, but it's not the workaround I'm searching for.

Ry-
  • 218,210
  • 55
  • 464
  • 476
lots_of_birds
  • 103
  • 1
  • 6

3 Answers3

4

I just had the same annoying error, but only when using the emacs GUI, not from the terminal. The problem with the proposed solution is that ^ isn't the only character not working. For me it was at least ` and ' as well.

From this thread: https://bugzilla.redhat.com/show_bug.cgi?id=918740 I found that changing XMODIFIERS from "@im=ibus" to "" solved the issue. While searching where XMODIFIERS where set I stubled across the following issue: https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/1125944 It turns out that by removing ~/.config/ibus/bus which solves that issue also solves the issue in emacs with dead keys

rm -rf ~/.config/ibus/bus
Morgan
  • 346
  • 1
  • 7
3

The error message tells you what name Emacs uses for the key. You can pass that string to the kbd function to bind it.

(global-set-key (kbd "<C-dead-circumflex>") 'next-line)
Porculus
  • 1,189
  • 8
  • 8
  • But you have to manually find and bind each dead key in that way. Lars' solution sets everything automatically in one line. – Bogey Jammer Jun 25 '15 at 14:58
2

Add the following to your ~/.emacs:

(require 'iso-transl)

This takes care of the problem with undefined dead keys.

Lars Haugseth
  • 14,721
  • 2
  • 45
  • 49
  • this did for me, thanks! (this is with Emacs 24.5.1 on Ubuntu 16.04 where I have no admin rights) –  Sep 08 '16 at 13:58
  • Are you sure this fixes ``? Didn't work for me. Setting XMODIFIERS to empty did it, but I like the other mode because it shows the dead key before pressing the following letter. – Gneuromante Feb 18 '23 at 16:38