closed that, re-incarnated here:

When starting emacs from the shell command line, if you pass the "dot", it opened emacs with a 'dired' of the current directory.

But can I do this?

emacs '*scratch*'

Basically I want to tell emacs (emacsclient) to be invoked with the argument "the file to be opened" being *scratch*

It would solve one of the problems I sometimes have: fyi I always start my day with cd ~/projecta; emacs . The issue with this is I can't freely kill 'dired' buffers. If I C-x k the 'dired' buffer for projecta root, emacs frame closes and I get dropped in to the shell.

Some context:

  • using macOS
  • Uses emacs only with Terminal.app ( -nw mode)
  • Emacs is client/server based, and each of my "customers" get their own entry in my .bashrc
    function emacs() {
      emacsclient -a "" -s workspace -nw "$@"

    function emacsb() {
      emacsclient -a "" -s workspaceb -nw "$@"

2 Answers 2


One option is emacs -e '(switch-to-buffer "*scratch*")'


The first line of the output of emacsclient --help is

Usage: emacsclient [OPTIONS] FILE...

It suggests that a file or directory must be provided to the command.

Also, like you, I create per-directory emacs daemons:

ec() {
    SERVER_NAME=$(basename $PWD)
    emacsclient -a '' -s $SERVER_NAME $*

The advantage of this is that if I close the file or directory that the emacsclient is opened with, the daemon persists.

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.