My workflow involves splitting frames a lot because I use i3wm. If I use the emacs native make-frame-command, the new frame will be visiting the buffer I invoked the command in. If I call emacsclient from a shell/keyboard short cut however, it default-visits the *scratch* buffer.

I'd like emacsclient to replicate the behaviour of make-frame-command. Is this possible?

  • All clients of a given server see the same buffer list (because the buffer list is a part of the server, not a part of the client), so your title doesn't make sense. Perhaps you could amend it?
    – phils
    Oct 17 '17 at 9:15
  • Hence the quotation.
    – yafov
    Oct 17 '17 at 9:22

Does this do what you're looking for?

emacsclient -e '(make-frame-command)'

If I do

emacsclient -e '(make-frame-command)' -t

it opens in a TTY instead of a new GUI frame, but then I have to do 'C-x 5 0' twice to get it to close...

  • 1
    That's close to perfect for my needs, I always run in GUI mode anyway. Thanks!
    – yafov
    Oct 17 '17 at 8:22

This hack works best for me

emacsclient -cne '(lambda () (interactive) previous-buffer)'

since emacs is dead set on switching buffers.

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.