Recipe: In your ~, you have a directory `helloworld' in which there's a file called `foobarbaz'. You don't have a directory named `demaille'. $ emacs -Q M-x partial-completion-mode RET C-x C-f ~/demaille/akim RET (message: Use M-x make-directory RET RET to create the directory and its parents) C-x C-f ~/hell/foo TAB (*error*: shell-command: Setting current directory: no such file or directory, /home/micha/demaille) This is due to a call to `call-process' within a buffer created after the `akim' one, from which it takes its default directory. I propose the following change, which AFAICT, fixes the bug: