>> 1. the current buffer should remain the same for the next command; >> 2. the buffer-local value of 'default-directory' should remain the same; >> 3. the next command should have a new value of 'default-directory'. >> >> I see no way to satisfy all these requirements. > > Except adding a variable like 'project-current-directory-override' > somewhere inside 'command_loop_1'. And indeed with the following patch replacing the current definition of 'project-switch-project' with just: (defun project-switch-project (dir) (interactive (list (funcall project-prompter))) (setq next-default-directory dir)) 'C-x p p (select project ...) RET M-& pwd RET' confirms that the command runs in the selected project directory. Whereas the original buffer keeps its previous buffer-local value of 'default-directory'.