When I type C-s using ansi-term in emacs, the shell becomes unresponsive. I can move the cursor around in the shell but I can't type anything. Is this some sort of obscure "feature", or is it a bug? How can I get around it?
It's an obscure feature: XON/XOFF flow control. C-s tells the computer to stop sending data to the terminal, because the terminal can't print or display the data as fast as the serial line is sending it. It made a lot of sense in the 1970s, but now it's pretty useless.
Press C-q to tell the computer to send data again. Press C-v C-s to send a C-s character to the application, and likewise for C-q.
If you want to turn off this feature, put stty -ixon in your shell startup file (e.g. ~/.bashrc). I don't know of a way to turn it off automatically by configuring ansi-term itself.
Related
NeoVim's terminal mode is cool, but what I really would like is to
be able to switch to normal mode to edit terminal with normal mode commands, is it possible?
I realize that when in this terminal mode, all input is responsability of the terminal, so I see that a mode where input interaction travels between vim and the terminal shouldn't be simple, if it's doable at all, I'd just like to confirm.
It is possible.
However, the user needs to use the <C-\><C-n> key combo first,
which will exit back to normal mode. Once in "normal" mode the user can navigate, set marks, visually select text, use registers to yank and paste the output somewhere else, etc.
If the user comes back to insert mode (i or a, e.g.) the cursor will come be back to the terminal command line.
For general information about the terminal emulator: :h terminal-emulator
For specific information on terminal's input: :h terminal-emulator-input. This section includes a bunch tips that might be handy, such as how to map <C-\><C-n> to <esc>.
In emacs, there is a feature where if I select text with a mouse, then without pressing
ctrl-c I can paste into emacs with ctrl-v if I have cua mode turned on.
I want to turn off this feature while keeping the cua mode on. I mean I want to
explicitly press ctrl-c so that the text will get copied to the clipboard.
I suspect that you are using a version of Emacs older than version 24? If so, see the last paragraph of this page of the current Emacs manual. You can probably get rid of the behaviour you dislike by setting x-select-enable-primary to nil.
From my quick tests, setting it to T (which isn't the default on Emacs 24) reproduces the problem behaviour, and this happens both in and not in cua-mode.
Is there some way to forward a keystroke to the shell when using Shell mode?
In particular, I sometimes want to use CTRL+\ to sigkill a process, but Emacs intercepts it
Another problem is that I sometimes want Tab to get forwarded to the shell to get default tab completion.
In general, M-x term, or even better, M-x ansi-term, give more complete emulators than M-x shell. Once you are in term-mode you can get into char mode with C-c C-j to interact with the terminal. Once you are in char mode, you should be able to use the terminal's tab completion and other terminal keyboard shortcuts. You can get back to the regular default line mode with C-c C-k.
You can read more about the differences between these modes here
You can press Control-Q before any other key to treat that key literally. So, C-q C-\ or C-q TAB should do what you want.
I'm using iTerm2 on my mac to ssh into a Linux box and run emacs in the terminal. On a big monitor, I like to split the window to see multiple buffers side-by-side. I'd like to be able to switch to a particular buffer by clicking the mouse in it (rather than doing C-x o).
What seems to be happening is that if I click the mouse anywhere outside the currently active buffer e.g. in the next buffer, on the mode line etc., the click is being interpreted as which is bound to (tmm-menubar-mouse EVENT).
I have disabled the menubar by doing the following in my .emacs_d/init.el:
(menu-bar-mode -1)
This seems to disable the visible display of the menu bar at the top of the window, but the mouse click behavior I described is still happening.
I think what I need is to have the click interpreted as something other than and then bind that to some function that detects which buffer the click happened in and switch to it. But, I don't know how to do that and the searching I've done hasn't yielded any clear answer. Can anyone help?
Alternatively, I looked into using windmove to enable switching between buffers with SHIFT and the arrow keys. I did (windmove-default-keybindings) but emacs then seems to respond to SHIFT left-arrow by inserting "2C" into the buffer and SHIFT-right-arrow by inserting "2D". If anyone has any tips on making this work too, I'd love to hear them.
Thanks
I ran into this problem a while ago, where clicking on column > 95 was interpreted as <menu-bar> <mouse-1>, which invokes tmm-menubar-mouse. It turned out to be a bug:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6594
There hasn't been a formal release since this bug was fixed, but you can get the patch here:
http://bzr.savannah.gnu.org/lh/emacs/emacs-23/revision/100618
If I recall correctly, you should be able to just drop the modified file into your existing emacs installation and byte-compile it (assuming you're running the 23.3.1, the latest release).
Several times now while programming in Emacs my keyboard has started to write Greek letters into the buffer. I assumed that I'd pressed some key combination but after searching I've yet to figure out what it is and my only solution right now is to restart Emacs. So what am I doing and how do I fix it?
Try to analyse what you've pressed.
M-x list-command-history shows command history
C-h l runs the command view-lossage which displays last 300 input keystrokes
I'm going out on a limb.
You're working on a windows computer that has multiple input languages configured (including greek). It also has the default keyboard shortcut to switch between them enabled (left alt+shift is the default, and if you have multiple inputs set up, it is on by default).
Some emacs shortcuts require an alt-shift combo, and depending on the order you press them, you get or don't get windows intercepting it for the IME switch.
Possible solutions include:
remove the greek IME
disable the windows shortcut to switch IMEs
change said shortcut
I typically want multiple IMEs on my systems, like that I can switch IMEs quickly, and don't want to mess with default shortcuts, so I ended up getting used to always pressing shift then alt when doing alt-shift combos in emacs.