I run Emacs in a MSWindows environment (via server launched with runemacs), and open new files with emacsclientw.exe -n [filename]. It works very well, except for a detail in the second case below:

  1. If the file to open already exists in a buffer, then Emacs raises the frame of that buffer, if such frame exists, otherwise it creates a new frame and displays that buffer. This is excellent.

  2. If the file to open does not already exist in a buffer, then Emacs first raises an existing frame, and then creates a new frame & buffer and displays the file in this new frame/buffer. This is OK except that the first frame raised often gets in the way of other open windows, so I must minimize it again.

Is there a way to make Emacs always behave as in case 1 above also for files that don't yet have a buffer? In other words, I'd like Emacs to display the new file in a new frame & buffer, without first raising any existing frames.

I've tried changing the options Pop Up Frames (which in my case had value never) and Pop Up Windows (original value non-nil) in various combinations of values, but they don't seem to help.

  • I don't have this behavior. If I use emacsclient <existingfile>, then the already existing Frame is used to open a new buffer with this file. If the Frame does not have that buffer, it is is opened. If no Frame (with or without a buffer of <existingfile>) then I must use 'emacsclient -c' to create a new frame. Same behavior when doing with <non-existingfile>.
    – Daniel
    Sep 22, 2021 at 19:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.