2

This may be user error, but if I open a file with

emacsclient -c file.tex

then if I try to reload the file using C-x C-v, then I get the usual

Find alternate file:

but if I press enter on that, I get

Buffer: `file.tex` still has clients: kill it? (yes or no)

If I say yes to that, the frame exits. If I say 'no', then nothing happens.

This seems to happen when the same file is open in multiple frames, using emacsclient everywhere. So presumably the same process is being used for these multiple frames.

Can someone explain what is going on here? What is the meaning of the message, and why does the frame exit instead of updating the file buffer in that frame?

  • There is something wrong in what you describe. What is your understanding of 'reload file'? – Nsukami _ Dec 27 '14 at 19:17
  • @Nsukami_ if the file has changed on disk, then reload the current version into the buffer. was the terminology I used incorrect? What should I have said instead? – Faheem Mitha Dec 27 '14 at 19:26
  • Ok, you are not using the right key for that. C-x C-v is the key for find-alternate-file funtion. revert-buffer is the function you need – Nsukami _ Dec 27 '14 at 20:07
  • Well, C-x C-v normally works. I'm just wondering why it is not working here. – Faheem Mitha Dec 27 '14 at 20:20
  • Normally? Can we know to which function the key C-x C-v is bound? And what's happening when using the revert-buffer function? – Nsukami _ Dec 27 '14 at 20:44
6

Essentially, find-alternate-file kills the current buffer and immediately opens another file (creating a new buffer in its stead). Normally, this is fine. When the buffer is killed, Emacs switches to the last most recent buffer, and then immediately switches to the new buffer.

In emacsclient, things work differently. If you kill all buffers created by that editing session (e.g. by answering yes in your example) then emacsclient deems that you are done with whatever editing you were doing and kills the frame. If you say no than find-alternate-file cannot continue (it failed to kill the buffer it's trying to replace) and halts.

I'm pretty sure this is a bug, and should be fixed.


However you still really should be using revert-buffer if you possibly can.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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