Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm at work, on a linux machine. I ssh into machine alpha, with X forwarding.

tomfuture@work$ ssh -X alpha

Then I start up X-windows emacs.

tomfuture@alpha$ emacs

It shows up on my local display. I do some work, and go home, leaving emacs running. On my linux machine at home, I can ssh in to alpha, and open up a new emacs frame connected to the same emacs.

tomfuture@home$ ssh -X alpha
tomfuture@alpha$ emacsclient -c

I now have two emacs frames running, one at work and one at home, both connected to the same emacs, which is running on alpha. From home, how can I:

  1. close the frame running at work? or
  2. close emacs entirely?

Thanks!

share|improve this question

1 Answer 1

You can close all other frames with function delete-other-frames, which is bound to C-x 5 1. You can close Emacs entirely by typing C-x C-c as usual. It will terminate Emacs, thus closing all frames.

share|improve this answer
    
Both of these seem to only close frames on the display I'm on. My goal is to close frames running on a different X-windows display. –  Tom Future Jun 25 '12 at 14:21
    
Both? If C-x C-c (which kills Emacs) leaves frames open on other displays, then those frames weren't drawn by the Emacs you are killing. Is it possible you are running two Emacs? –  Fran Jun 25 '12 at 14:23
    
ps aux lists only one emacs process. M-x describe-key C-x C-c says that C-x C-c is bound to save-buffers-kill-terminal. It describes this function as "Offer to save each buffer, then kill the current connection. If the current frame has no client, kill Emacs itself." I'm not sure what it means for a frame to have a client, but it doesn't seem like C-x C-c is meant to always kill emacs. –  Tom Future Jun 26 '12 at 14:40
    
Try binding C-x C-c to save-buffers-kill-emacs by putting this code at the end of your ~/.emacs startup file: (define-key global-map (kbd "C-x C-c") 'save-buffers-kill-emacs). I suspect that function save-buffers-kill-terminal is causing the behavior you don't like. –  Fran Jun 26 '12 at 17:14
    
save-buffers-kill-emacs does the job (after warning me that it's going to delete another connect, which is nice). Thanks! –  Tom Future Jul 19 '12 at 16:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.