Caps lock rebound to ctrl generates Ctrl-Shift in emacs - emacs

I've rebound my caps lock key to be an additional ctrl key, but in emacs using the rebound key generates the C-S key combination. Pressing caps-p generates the sequence C-S-p, whereas using the the ctrl key to do the same generates C-p.
This results in some weird behaviour, such as C-n and C-p setting a mark and then highlighting the region that I go through.
I have not changed the definition of the caps key in X, instead using the setting built into my window manager (Cinnamon). Could this be what is causing the problem, or is this the intended behaviour of this key?

This question is probably relevant, basically just use xmodmap to set the keys directly. It worked for me when I had caps lock set to control and I think I was using gnome3 classic (which Cinammon is based on) at the time.
On a related note I'd also recommend having a look at space2ctrl, I found that reaching for caps lock all the time still hurt my fingers.

I'm running CrunchBang 10 "Statler" (derived from Debian 6 "Squeeze") on an Asus laptop
(yeah, I'm a little behind right now)
I've currently got GNU Emacs 23.2.1. It didn't even recognize the Caps Lock key as a keypress until I re-mapped it to Ctrl using xmodmap.
So first I created file ~/.Xmodmap:
! attempting to redefine the <Caps Lock> key to do <Ctrl>
remove Lock = Caps_Lock
add Control = Caps_Lock
Apparently Debian uses .xsession, vs..xinitrc.
file .xsession is where the window manager (Openbox) gets started with exec
I inserted the xmodmap call before the exec:
#!/bin/sh
# gonna modify the keys so <Caps Lock> is <Ctrl>
xmodmap /home/tom/.Xmodmap
exec openbox-session
The Caps Lock key seems to be working just like the Ctrl key
within Emacs now.

I also faced this problem before, my keyboard has problem with CTRL key. Maybe you have the same problem.

Related

C-<SPC> is intercepted in emacs -nw (terminal intercept?)

I use urxvt (terminal) under awesome (window manager) and ubuntu (os).
In graphical mode, c- set the mark but in text mode it inserts a space.
The problem is solved when using gnome-terminal but some other key combinations still does not work. For instance, C-: insert a : in both terminals.
I do not know where to look at to correct this behaviour.
C-h k (help on key combination) followed by one of these combination shows only the key pressed along ctrl, for instance C- is interpreted as .
As stated in comments, the terminal is probably the cause. I believe that C- should not enter a space at the terminal prompt, which it does here.
I identified this question as being related. This one too.
In my case, Ctrl-Space was being used to change input methods. Running ibus-setup and unbinding it fixed my problem (it now produces Nul)
See also: https://askubuntu.com/questions/243639/ctrlspace-has-been-bound-to-invoke-some-input-method-and-does-not-work-in-ema

Why doesn't emacs detect C-<backspace> combination?

My problem is that I want to bind Control + Backspace combination to backward-delete-word function. However, it doesn't seem possible because emacs doesn't detect the Control key in combination with backspace.
I detected that by looking at the "logger" (C-h l). So if I press Backspace, it shows DEL. If I press Control + Backspace, it still shows DEL.
Is there any way to achieve that?
I have read and tried other questions, but couldn't fix it.
As #phils pointed out, if you are using Emacs in a terminal (e.g. emacs -nw) instead of as a GUI (no -nw command-line option), and if you are not on MS Windows, then by default certain key sequences are not available to you.
However, it might still be possible for you to configure the terminal (e.g., xterm) so that it in fact supports some such key sequences for Emacs. See this comment by the Emacs maintainer in the discussion of Emacs bug #10387.
(That said, you might find it simpler to just use a different key sequence. Or switch to the GUI version of Emacs.)

How to remap C-x prefix in emacs to a dedicated key?

Many emacs commands start with C-x or C-c. I found that I never use the right shift key. So I was thinking if it's possible to remap C-x to Shift. To open a file, I can do Shift-Ctrl-f instead of C-x C-f. Here I would prefer Shift-Ctrl-f than Shift Ctrl-f.
The link created by SSH between machines does not transmit the pressing and releasing of the shift key; only when another key is pressed in conjunction with Shift is a character transmitted, and the character — upper case H when Shift and “h” have been pressed, for example — looks the same to the remote machine whether left or right shift was used.
Therefore, to make right Shift visible, you will have to tell the terminal program to consider it to be a different key — or maybe even have to tell the Mac system settings that it is no longer Shift?
Is it possible to explain to your Mac that pressing Shift sends the character Control-X? That would kill both birds with one stone!

M-RET and M-UP/DOWN not working in Emacs org-mode in console/terminal

I'm using emacs23 on Ubuntu 32-bit 10.04/10.10 with GNOME and Compiz.
Pressing M-RET in an org-mode plain list in Emacs (GUI) inserts a new item. Pressing M-Up moves the item up in the list.
These keys don't work as expected in emacs -nw under Terminator and gnome-terminal. The M-Up key does nothing, whereas the M-RET key simply moves the cursor down one line and indents the position. The keys also don't "work" in xterm, which inserts \215 instead. Pressing ESC-RET or ESC-Up instead produces the expected functionality. The same problems exist if I run emacs -nw on a headless server accessed via ssh under Terminator, gnome-terminal and xterm.
I've searched both generally and on the org-mode Gmane list for an answer to this, but have not found anything. Is this a known issue with org-mode or is it related to the terminal emulator and/or the Window Manager?
In addition to the keys in my question, S-TAB, S-Left, S-Right, S-Up and S-Down were not working over ssh and PuTTY. Using certain keys on a TTY connection (ssh, screen, PuTTY) is a known issue.
Alternative keys are included in org-mode as detailed in 'Using Org on a TTY' in the org-mode manual.
Alternative key combinations exist
for equivalent to M-RET
M C-m
"<return>" is the Return ↩ key while emacs runs in a graphical user interface.
"RET" is the Return ↩ key while emacs runs in a terminal.
"RET" is also equivalent to "C-m" (【Ctrl+m】). (http://ergoemacs.org/emacs/emacs_key_notation_return_vs_RET.html)
as equivalents for M-<up/down> you can use
ESC-<up>
ESC-<down>
The menubar of terminal emulator is not letting the M key that is meant for Emacs be passed down to Emacs. For Emacs to receive the M key as it is supposed to, you could either use the Esc or disable the menubar and use M key in Emacs as usual.
ADDED:
For the xterm, if you do CTRL+Mouse Button 1, you will see "Meta sends Escape". You need to make sure that option is checked/enabled to make M work as it should in Emacs.

How to remap keys when in Emacs?

I am looking for a way to have my control key and caps-lock key switched when I am in the emacs window, but when I go to any other program such as Firefox I want to be able to use the normal control button for new windows, tabs and such.
Additional Information: I am using Ubuntu, but answers for all systems are good since someone else may want to know how to do it on their system.
Emacs never actually sees the CapsLock keycode (under X anyway), so you can't remap the key in Lisp. Take a look at this page for details:
http://www.emacswiki.org/emacs/MovingTheCtrlKey
On windows using Auto Hot Key you can achieve this with this piece of code put in default script:
#IfWinActive, emacs#
CapsLock::Control
#IfWinActive
Auto Hot Key is a very handy utility and it is also free software like in GPL.
For globally remapping keys there is xmodmap. xkeycaps is an interactive tool. You can put control on both keys.
Since you want to remap the keys only for Emacs (which I find somewhat ill-advised) you need to look inside Emacs for a solution. It should be possible, because you can rebind all keys, but it may be too tedious to swap all keys around if the modifiers cannot be swapped.
Personally I map CapsLock to Compose, to type all kinds of funny characters like ä, ß, å, þ, «, —, ...