Znatz
Znatz

Reputation: 1530

Why can't I set mark on emacs?

I am trying to run Emacs on a guest system (Ubuntu 12.04)

inside a Windows 8 command console.

This is done through vagrant + Virtual box.

It looks like this,

Guest system : Ubuntu 12.04

Host system : Windows 8

Environment : Virtual Box + Vagrant

enter image description here

Emacs works fine except I can not set mark on text (C-SPC).

I supposed there is some kind conflict with the key binding.

So I tried and added this to init.el,

(global-set-key (kbd "C-8")   'set-mark-command)

It doesn't work either.

Would someone please advice me?

Upvotes: 0

Views: 2565

Answers (2)

Znatz
Znatz

Reputation: 1530

Thanks a lot for the hint.

I finally figured out what the problem really is.

From the answer @phils, this link clarifies the problem.

Why does Ctrl+. not work when I bind it to a command in Emacs?

In my case, all C-[any other key] bindings work, except for the set-mark-command.

I found a workaround.

By adding the following code to .emacs.d\init.el I can use F8 to set mark now.

(global-set-key [f8] (quote set-mark-command))

It is still confusing why in other command, Ctrl+key bindings works.

Upvotes: 1

phils
phils

Reputation: 73274

If you're running Emacs in a terminal, then C-SPC and C-8 are unlikely to send what you want them to.

Use C-h c C-SPC to ask Emacs what it's seeing.

Try using C-@ instead.

FYI, I found the Cygwin X server excellent for running GUI Emacs in a Windows-hosted VM. With GUI Emacs you can use many more key combinations than a terminal emulator will permit.

If you try that, start the server with startxwin rather than startx (the former enables the X server's windows to appear as regular Windows windows), and then connect from an xterm with ssh -X or ssh -Y (see the man page) to connect with X11 forwarding.

Upvotes: 3

Related Questions