Chris Seymour
Chris Seymour

Reputation: 85765

Closing emacs in emacs

Occasionally when using emacs in term mode I will mistakenly run emacs file instead of just opening the file. This will create a nested emacs client inside the current client. My problem is how to close the inner client only?

Upvotes: 3

Views: 431

Answers (3)

Nicolas Dudebout
Nicolas Dudebout

Reputation: 9262

Just use the command M-x kill-emacs inside the inner emacs. Backgrounding and killing it works fine but it is a little bit more hackish.

Upvotes: 5

Vash2593
Vash2593

Reputation: 119

You should use the top Emacs. Starts emacs with:

emacs --daemon

Starts all frame with:

emacsclient -c

From your term:

emacsclient -n

Or you should use eshell instead.

Upvotes: 0

Chris Barrett
Chris Barrett

Reputation: 3375

Answer

You should be able to C-z out of it, then kill it with

kill %1

Explanation

C-z will suspend the current process, assigning it a job number and returning you to the shell.

The jobs command will show you the current jobs and their numbers. kill allows you to kill a process by its job number using the %n syntax.

Upvotes: 6

Related Questions