In my XTerm, I want to open new Emacs frame as well as buffer, with working directory set to $PWD in XTerm env.

I tried emacsclient -t -c --eval "(cd $PWD)", but it doesn't seem to work. Is it possible?


1 Answer 1


If you want to create a buffer for a new file ./new-buffer in the current directory, just call emacsclient with that filename, like

emacsclient -t ./new-buffer

The option -t causes emacsclient to open the buffer in a newly created frame on the current terminal.

If you create a new non-file buffer the default directory for that buffer is the current directory of emacsclient.


emacsclient -t --eval "(eshell t)"
emacsclient -t --eval "(switch-to-buffer (generate-new-buffer \"*new-buffer*\"))"

Your Answer

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

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