>> There is no code where to bind a dynamic variable, because its value >> should be available for the next command in the command loop. >> If you agree there is no other way to implement this than next-default-directory, >> then I could bring up the discussion on emacs-devel. > > Before we dive into all that, why not try advice on 'command-execute'? For > the PoC code at least. It's in Lisp since 2013. Thanks for bringing up 'command-execute'. I forgot it was moved from C to Lisp, so the change is simpler and not needed to discuss on emacs-devel. Then advice on 'command-execute' will be required to support older Emacs versions in project.el. But for Emacs 30 I modified my previous patch, and the next version is below: > The comment in its body does say "Called directly from the C code", but I'm > not sure if that has any direct implications for us. Also interesting how 'command-execute' handles 'debug-on-next-call' similar to 'next-default-directory'.