48

I am not able to set the mark at the current point by C-SPC (both when emacs loads the init file and when it doesn't). However, when I do M-x set-mark-command, the mark is well set and I am able to select the region by moving the cursor. When I do M-x apropos set-mark-command, it shows two bindings C-@ and C-SPC, but only the first one works. Any suggestions will be appreciated. I am running emacs 24.3 on a GUI on Kubuntu 14.04.

Sagar Jha
  • 1,068
  • 4
  • 14
  • 24
  • 4
    It's possible that something else on your machine is bound to `C-SPC` and is capturing the keypress before Emacs sees it. What's your environment like (OS, window manager, Emacs version, are you running in a terminal or in a GUI window, etc.)? – ChrisGPT was on strike May 04 '14 at 12:23
  • I imagine you're running Emacs in a terminal? Terminals don't send a lot of sequences which are available in the GUI environment. What does `C-h k C-SPC` tell you? – phils May 04 '14 at 12:38
  • 2
    No, I am running emacs in its GUI. C-SPC worked before I upgraded to 14.04 (however, I cannot tell you what was the exact point where it stopped working). I tried C-h k C-SPC. But after typing C-h k, C-SPC does not produce a response. Might be that the command does not reach emacs, as Chris suggested. – Sagar Jha May 04 '14 at 12:41
  • @SagarJha, I experienced something similar going from Ubuntu 13.10 to 14.04. `C-SPC` works in Unity (the default interface), but it stopped working in [i3](http://i3wm.org/), a tiling window manager that I like to use. I haven't had an opportunity to debug it myself yet... – ChrisGPT was on strike May 04 '14 at 12:50
  • 3
    @SagarJha, it looks like [this Ubuntu bug](https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/1278569)? – ChrisGPT was on strike May 04 '14 at 12:55
  • yes, exactly the problem. I think too that it is an ibus error. Sometimes in the past, when I opened emacs using terminal, I got a ibus warning. – Sagar Jha May 04 '14 at 13:07
  • 1
    Thanks, Chris. I was able to solve the problem by running ibus-setup and changing the key-binding for `next-input` method from C-SPC to something else. Please put this as an answer. – Sagar Jha May 04 '14 at 13:52

3 Answers3

71

Ubuntu 14.04 has an open bug affecting some desktop environments (at least KDE, LXDE and i3, but not Unity).

The default IBus key binding for "next input method" is Ctrl+Space, which prevents this key combination from reaching Emacs (or any other userspace program). To resolve the issue, run ibus-setup and change the key binding for "next input method" to something else (or delete it entirely by clicking the "..." button and then the "Delete" button).

Note that running ibus-setup from Unity, where C-SPC works already, shows a preferences window that does not include the key binding option that needs to be changed.

The "next input method" command cycles through your configured inputs, e.g. perhaps from English to French.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • In addition to KDE and i3, LXDE is also affected by this issue (as witnessed in Lubuntu 14.04.1). – Piotrek Nov 04 '14 at 14:09
  • I encountered this problem with Linux Mint Cinnamon as well. – T.C. Proctor Jun 20 '16 at 22:43
  • Cant this issue be reported to ibus project ?and suggest to set something else by default ? like Shift+Space ? – RzR Jul 20 '16 at 12:11
  • @rzr, you could report it upstream (and I'd be surprised if that hasn't already happened), but there's no way to guarantee a unique key binding. I don't imagine they'll change their UI to accommodate Emacs users only to risk the anger of some other set of users. – ChrisGPT was on strike Jul 20 '16 at 13:09
24

So I tracked down a similar issue to this on macOS. It seems that at some point C-SPC became bound to "Select the previous input source":

keyboard preferences pane

Will
  • 4,585
  • 1
  • 26
  • 48
5

I just had the same issue today which I never had before. I am on Windows 7. As it turns out the Ctrl+SPC is bound to the OS's language switch. So the keystrokes are not sent to emacs at all.

But one thing that is even more weird is that I have never installed new languages/keyboards, yet the 'CH PRC' shows up in my language bar as a language/keyboard today. It turns out to be a Windows 7 bug and all I had to do to fix was:

  • Add 'CH PRC' in the language bar then Save.
  • Remove the language then Save again.

I know you are not on Windows, so the fix may not be the same as mine, but it is very likely Ctrl+SPC is bound to your OS's language switch as well.

Liang Zhou
  • 2,055
  • 19
  • 20