How to terminate process inside EShell mode? - emacs

Background Information
I am using Spacemacs as my default configuration. I am running a JavaScript infinite loop inside my EShell using Node.js. In the regular terminal, I usually terminate it by using C-c. What should I do inside EShell?
I have read the section about shell mode and terminal emulator in the Emacs doc, but find no help and related command to terminate the process.
Question
How can I terminatr the process inside EShell-mode without restarting the editor? Although restarting the editor does solve the issue.
Even killing the buffer does not work. Oh dear, it is still running.

Solution
C-c C-c, eshell-interrupt-process.
Huge thanks to #tripleee.

Related

Resize the terminal in vscode is trigger the ctrl+c to terminate the running command

I'm running the vscode 1.64.2 on Windows 10. Currently i met a strange problem, When i resize the terminal in the vscode and the cursor is focus on the terminal, Then it will trigger ctrl+c . At this time any running command would be terminated immediately .
To avoid this i have to un-focus for the terminal first and then resize it. Any suggestion here?
I was searching about this with no luck. Today I realized about one installed software on my machine that has a global hook on mouse selection. In my case was the QTranslate software. When I exit the application the problem was solved.
Check if you have this or another software that has a global hook on mouse selection.
In VS Code this problem (control C) was happening for any command line inside the terminal. Apart from that, opening Git bash (standalone) I was having the same issue, but not for cmd or another command line.
Hope this helps you because this was driving me crazy.
Absolutely working solution!
I experienced the same problem with mouse strange behavior for a long time, but finally I found out it was the QTranslate's guilt! After I stopped it, the problem has gone. (can't vote up because of my virgin profile here).
PS: I found the solution how to push work both QTranslate and terminal window - just set QTranslate setting "Advanced->Copy action" to "Ctrl+Insert" instead of Ctrl+C.

Launching ipython in emacs undesireably moves my windows

When I launch ipython in emacs, it rearranges all the windows. I find this annoying. Yet experimentation with my .emacs file yielded no solution. Where should I look? What should I suspect? What can I query?
With python-mode.el the behaviour is controlled by customizable variable py-split-window-on-execute.
For changes on the fly exist commands py-split-window-on-execute-off, py-split-window-on-execute-on

How to make Emacs operation safe without hanging or crashing the whole editor

In my understanding, an operation should really not hang the editor. I can at most accept the fact that this operation is not successful, but what I encountered is that I frequently crash my emacs instance.
opening a remote file => hang!
syncing a shell buffer PWD => hangļ¼
Is this really the case, or are there some configuration options we can make use of to to avoid the hangs?
I will add the steps I used to produce the crash: my emacs versin ( GNU Emacs 23.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.22.1) )
C-x C-f (some remote file) /user#host:/var/tmp/a.txt ( never
succeeded )
several change directory (under M-x shell ), and then M-x dirs (
frequently stuck )
I have to admit that C-g works to stop these stuck operations sometimes.
I also thought Emacs should be one of the most robust editors in the world, but the truth is it crashes. Sometimes it hangs... maybe it is a result that I am using a lot of unnecessary plugins. Use C-g to unhang it.

Can't set breakpoints when using gdb in emacs (or DDD)

I'm trying to use gdb with emacs. The library that I'm trying to debug is loaded by a process and can't be run directly. Hence I attach to the process by using the attach command inside gdb. Attaching to a process and setting breakpoints works fine when I use gdb from a shell, but when I use gdb in emacs (by pressing M-x gdb or M-x gud-gdb), it can't set breakpoints. It shows me an error which says "Can't access memory at 0x7efb04". I'm using emacs 23.1.1.
Here is a breakdown of the process I follow:
Press M-x gdb or M-x gud-gdb to launch gdb inside emacs.
Enter the name of the executable built with debugging symbols.
Type "attach [PID]" to attach gdb to a running process.
Set a breakpoint by typing: filename:line number.
The last step gives me an error which says "Can't access memory at 0x7efb04".
Any ideas why this is happening?
EDIT : I get the same error when using DDD (UI for GDB). So I guess it's not an emacs specific issue.
Have you compiled with debug-information? Do you have some code which shows the problem?
Does this happen in other IDEs also?
I figured it out. The problem is with step 2. Entering the name of the executable built with debugging symbol causes the problem. Instead, just launching GDB and attaching to process works fine. I'm not sure if this is the expected behavior.
In DDD, the executable with debugging symbols has to be opened first before we can attach to process. I don't know how to get around that in DDD.

Running Emacs Remotely between several machines

I use Emacs remotely using X-Server in a Windows client and Linux server. I noticed that I can halt it using ctrl-z and then type fg 1 to get it working again. Is there some way that I could get it to halt on the machine that I am on, and then log into a different machine and start where I left off? When I start a new ssh session, the emacs job isn't associated to my terminal. There must be someway to "steal" it.
Also, maybe there's an Emacs feature that will do basically the same thing. However, I think closing and re-opening all my files and buffers would take quite a while.
Expanding on the idea of using emacsclient, you can look at what what someone did to solve the problem of editing a file from a different machine than where (s)he started running Emacs.
As of Emacs 23, you can run emacsclient in terminal windows using the -nw option.
Other solutions you might want to try are to use:
gnu screen
vnc
For years I used screen to "attach" and "detach" from a virtual terminal that sounds like your usage model. If you have the ability to use graphics... vnc is really great, just do your work in a vnc session and connect to it any machine.
And your last idea is already implemented by the package desktop (which is bundled with Emacs). Take a look at the wiki page for session management, which includes other alternatives to desktop, as well as add-ons for desktop to lazily load files.
You can run emacs as a server, and use emacsclient to connect to it. You can open multiple connections to the same emacs server, via ttys or X11.
When doing this, C-X C-C will close your connection, and leave the server running.
A simple way to do this by invoking emacs as follows. This will connect to the server if one is running, or create one.
emacsclient --alternate-editor="" -c
Sometimes I will be at work and have to run out the door leaving my Emacs session as it was. Later, I will open an Emacs instance to the same machine (usually using remote SSH) and find that I have files open in Emacs. Now the good news. Emacs allows you to "steal" those files using M-x recover-this-file. I recommend one of Trey's solutions if you can plan ahead. If not, you can use this recover file technique to keep progress moving.