Usually, when you open a file, Emacs prompts you to run M-x make-directory RET RET if the directory doesn't exist.

However, after writing my own advice, I realized that opening files in directories that don't exist was giving me a lot of errors. After digging a bit, I found that apparently make-process tries to set the current directory to the buffer's default-directory. Since it doesn't exist yet, it fails with an error saying that setting the directory didn't work.

Is there a way to prevent this, and still have the make-process command work? I looked at the keyword arguments, but I couldn't find any that would prevent the working directory from being set.


Reading in make-process comments about "current buffer's current directory", assume this is a bug. Can't see why a buffer connected to a process must have a file resp. filename. Seems worth a bug-report.

  • To make sure I explained this correctly, let me elaborate a bit. I meant that when you create a process with make-process, Emacs tries to set the working directory of the process to the default directory of the current buffer. I didn't mean that the buffer it creates (i.e. the buffer key in the arguments) has that set as its default directory. Reading your answer, I thought you might have thought I meant the second one, and not the first. – Parham Doustdar Jun 14 '18 at 9:59
  • @ParhamDoustdar AFAIU make-process assumes an existing buffer-file-name leading to determine the current directory. But such assumption isn't justified when just creating a buffer. – Andreas Röhler Jun 14 '18 at 10:58

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.