8

I have Ubuntu 12.04 running with Emacs 24.3. On computer startup, emacs --daemon is executed, and I have modified the emacs24.desktop to take emacsclient -c -a "" as exec parameter. However, whenever I try to open a file a new frame opens every time.
Is there a way to make the file appear in a preexisting frame as a new buffer?

By “open a file” I mean using either GUI file manager or using terminal by emacsclient -nc [filename] or emacsclient -nc -a "" [file].

EDIT: What seems to be happening is that emacs is opening a new "OS window" (as in Emacs frame) with every file; however, I am able to access all the buffers in the same emacs frame. Still, having multiple emacs frames in irritating even though I don't have to switch through them. Closing the frame manually removes the buffer too.

Is there a way to suppress the behavior of opening the new frame every time?

  • What is the "-nc" option you have in your commandline. I see "-nw", "-c", "-n" but no "-nc" option when I do emacsclient -help. – Kaushal Modi Sep 28 '14 at 14:33
  • -n is for no-wait while -c was to create new frame (I didn't realized it created new frame every time). Without -c, emacsclient starts emacs in the -nw mode for some reason. – strNOcat Sep 28 '14 at 19:13
  • 1
    Yes, but I am not sure if -n and -c can be merged into -nc. – Kaushal Modi Sep 28 '14 at 19:26
  • It gives the same behavior. But yes, that was careless on my part; thanks. – strNOcat Sep 29 '14 at 3:58
7

Your included option of -c is causing this. Per the man page,

-c, --create-frame create a new frame instead of trying to use the current Emacs frame.

Remove this option from your command and Emacs should refrain from creating a new frame (AKA Window).

  • If I don't use -c, emacsclient opens emacs in the terminal for some reason – strNOcat Sep 28 '14 at 9:07
  • That is only true with the '-nw, -t, --tty' option. What command are using without '-c' that is opening Emacs in the terminal? – Andy Sep 28 '14 at 10:20
  • emacsclient path_to_file – strNOcat Sep 28 '14 at 13:27
  • 2
    On my pc emacsclient filename only opens emacs in the terminal if there is no frame already present. If a frame is present, the buffer is opened in the frame. – Vamsi Sep 28 '14 at 23:27
  • @Vamsi Ah, you're right, thanks. Simple things! – strNOcat Sep 29 '14 at 3:57

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.