If I invoke emacsclient with emacsclient -na runemacs file1 emacsclients switch to the frame containing file1. But if later I invoke emacs with emacsclient -na runemacs file2 emacsclient opens file2 in the existing frame of file1.

On the other hand emacsclient -cna runemacs file1 always creates a new frame regardless of if file1 is already opened or not.

I prefer that emacsclient creates a new frame of a file if that file is not already open in the existing frames, otherwise emacsclient switchs to the frame containing it.

I guess I should send some elisp code by -e option to the emacsclient for checking this but I was not able to find the right code.

There is a related question Make emacsclient create a frame only if there isn't one already without an accepted answer. The upvoted answer there uses a bash script hence not a pure elisp solution.

  • Why is it important for it to be pure elisp? – Qudit Dec 17 '16 at 18:35
  • One reason can be an elisp solution also works an the platforms where bash is not available. – Name Dec 17 '16 at 18:41

Your Answer

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

Browse other questions tagged or ask your own question.