|
From: | Dmitry Gutov |
Subject: | bug#63648: 29.0.90; project.el: with switch-use-entire-map, switch-project errors on non-project commands |
Date: | Thu, 31 Aug 2023 05:01:41 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
On 30/08/2023 19:27, Juri Linkov wrote:
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'.
I've tried the patch a little bit, some more impressions:- Unfortunately, using default-directory instead of the specialized variable which we added lately (project-current-directory-override) brings back the bug it was added for: https://debbugs.gnu.org/58784. The switch to a different design didn't fix the problem of the temporary binding for d-d in the buffer which is current when the command is executed. So adding the next-default-directory variable might not be the best idea after all. But the advice thingy can set a binding for any variable, including the *-override one.
- I also managed to get into some transient state where some chars were doing one thing (their usual bindings), and some - invoked project commands instead, with no apparent method of quitting that state. Maybe I'll document it next time I see it.
- Using (project--keymap-prompt) for just a message call is cute, but I personally like the "guardrails": if I accidentally type a wrong char when choosing the command, I won't have to choose the other project again. This is debatable, but both modes of operation are probably worth keeping available (opinions welcome).
- Either way, with method with the advice should be useful for other things, like project--other-place-command.
[Prev in Thread] | Current Thread | [Next in Thread] |