I've recently started using screen in remote sessions. One problem is that emacs doesn't recognize its C-a and I don't want to bind emacs C-a to something else, as I'm very used to it.
Google shows ways to change every keybinding individually using ~/.screenrc but not how to change a keybinding globally. I want all C-a to change to something else. Is that possible? What are my options?
Thanks for your answers
You can change the escape combination via escape in .screenrc:
# Makes Control+b become the escape combination
escape ^Bb
You can also just use Ctrl + a a to pass a Ctrl + a to the child process. You get used to it after a while.
Related
In Haskell-mode, the shortcut C-c C-= is defined to do something.
Trying this shortcut, I realized that emacs do not recognize the shortcut C-c C-=.
Indeed, when I try the shortcut on emacs, the buffer write C-c = is not defined although I pressed C- C-=. I have the same problem with some other symbols like '.' or '§'. But shortcuts like C-c C-l or C-c C-c work.
I try to remove my .emacs but I have the same problem.
a friend have the same problem as me.
Both we are on ArchLinux (64 bits) and we use emacs in console. The keyboard is an azerty.
The problem come from emacs ? Arch Linux ?
Your terminal can't send Emacs C-= so you can't use that key sequence. (Emacs would recognise it if it received it, but that won't happen.)
Your options are:
Run GUI Emacs.
Use M-x name-of-command RET (for whatever command is bound to the key sequence you're not able to use). Use C-hm to see the major mode's bindings, or C-hb to see all current bindings, in order to learn what those command names are.
Create new custom keybindings for the commands in question (i.e. bindings which your terminal can send to Emacs).
Find a different terminal emulator with enhanced key sequence abilities. The vast majority of them will be no better than what you have, because they're all adhering to the limitations of the terminals they're emulating. The most capable one I know of is http://invisible-island.net/xterm/xterm.html but you may need to compile it yourself, and then expect to spend lots of time configuring it. (It's not a trivial solution, though, and xterm requires a GUI environment, so running GUI Emacs is much simpler.)
Use C-x#c<key> instead of C-<key>.
With that last option, you can use a sequence your terminal can send to fake a sequence that it can't send.
C-cC-= would become C-cC-x#c=
If you really wanted to use that last option, you can set a custom binding to simplify the sequence (may be necessary in some instances to avoid conflicting with existing sequences). See the end of https://stackoverflow.com/a/24804434/324105 for more information.
To add to phils' post - another option is an Emacs package (which I wrote), which can teach Emacs and terminals how to properly recognize all PC keyboard keys and modifier key combinations:
https://github.com/CyberShadow/term-keys
The default configuration already includes encoding key combinations like Ctrl=, as well as similar variations.
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.)
In emacs (ver. 24.3), I have my forward-paragraph and backward-paragraph mapped to M-p and M-n instead of M-{ and M-}. It is easier for me to remember and use fluidly with C-p and C-n. I've recently started using multi-term to run most of my terminal work. However, when I switch to line-mode my custom bindings for forward and backward paragraph no longer work. It says 'empty input ring'. Oddly when I'm in char-mode, the C-p and C-n do what they are supposed to do (bringing up previous prompt entries), but my paragraph movements work.
So in short, my custom forward and backward paragraph bindings work in char-mode (where I don't really need them), but not in line-mode. Any ideas?
See term-bind-key-alist, which includes C-p, C-n, M-p, and M-n by default. See also these passages from the EmacsWiki page MultiTerm. The second especially seems relevant to your problem. These do not mention term-line-mode or term-char-mode, but I think they might give you a place to start.
Note 1
‘term-unbind-key-list’ is a list of keys which emacs keeps for itself. By default it contains (“C-z” “C-c” “C-x” “C-h” “C-y” “”)
‘term-bind-key-alist’ is a list of keys and functions which you can use, for example to use Emacs style cursor movement to the multi-terminal. The default is long, so I’ll let you look it up yourself.
Note 2
Because C-r is default keystroke for isearch-backward, for avoid conflict with C-r, i binding M-r to send “C-r” character to shell.
You can use option term-bind-key-alist/term-unbind-key-list to binding/unbinding special keystroke in multi-term.el, and don’t use term-mode-hook. ☺ –- AndyStewart
Also, I don't see term-line-mode anywhere in multi-term.el. It looks as if it makes use only of term-char-mode. See, for instance, multi-term-keystroke-setup.
I have installed Emacs on my FreeBSD 8.2 box. Everything works fine but I cannot use tabs. When I am editing a file with emacs and hit tab, nothing happens.
What could be causing this?
If you're new to Emacs, you might expect pressing TAB to insert a literal \T. For various reasons, that's not the way most Emacs modes work. Most editing modes auto-indent your code as needed (<tab> is bound toindent-for-tab-command rather than self-insert). If the line you're TABbing on is already at the correct indentation level, it might seem that nothing happened.
Auto-indenting like this is easier and more consistent than manually indenting, but doesn't give you as much flexibility when it comes to deciding exactly how much whitespace is going to be present at the beginning of each line (and it also causes some problems when you want to, for example, tab-separate some fields). You can auto-indent a region using C-M-\ (that's Ctrl + Alt + \).
If you absolutely, positively must insert a literal \T into your code somewhere, you can do so using C-q TAB (press and release Ctrl + q and then press TAB). Typically, this is done to align columns in other editors; if that's what you're doing, it's probably a better idea to use align-regexp rather than tab literals.
In fundamental and text-mode I use C-<TAB>. I do not know which other modes this works in, but with few exceptions, plain text is the only time I need an actual \t character.
I'm using emacs 23 on ubuntu 10.04. I would like to remap the "C-[" binding. Currently, when I press it, it gives me "ESC". Is there a way to remap it?
This is not an Emacs binding, but has global effect in X and it's used as handier substitute for ESC for people practicing touch typing. I guess you'll have to modify the X keymap if you want to use it in another fashion, but I wouldn't advice that.
C-[ is the ASCII ESCAPE character, which Emacs usually writes as ESC.
There is no key involved here (it's a character), and there is no key binding involved here. Or rather, your keyboard's Escape key sends the control character ESCAPE (also written C-[ and ESC).