GNU bug report logs -
#63648
29.0.90; project.el: with switch-use-entire-map, switch-project errors on non-project commands
Previous Next
Reported by: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Mon, 22 May 2023 16:29:02 UTC
Severity: normal
Found in version 29.0.90
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
Full log
Message #170 received at 63648 <at> debbugs.gnu.org (full text, mbox):
Hi Juri,
On 10/09/2023 18:30, Juri Linkov wrote:
> So here is a complete tested patch that maintains backward-compatibility
> with older versions, and is localized to project.el without the need to
> discuss more fundamental changes on emacs-devel, and handles 100% of
> known cases such as reported in bug#58784, bug#63829, etc.
It sounds like a possibly concise solution, but I'm still wrapping my
head around it.
> +(make-obsolete-variable
> + 'project-current-directory-override
> + 'project-current-directory-old
> + "30.1")
Aren't those variables sufficiently different that making one an alias
for another would confuse things?
> +(defvar-local project-current-directory-old nil
> + "Value to use instead of `default-directory' when detecting the project.
> +For the next command after switching the project, this buffer-local
> +variable contains the original value of `default-directory'.
> +Whereas the buffer-local `default-directory' is temporarily set
> +to the root directory of the switched project.
> +When it is non-nil, `project-current' will always skip prompting too.")
The docstring is valuable, but I wonder how it looks to somebody from
the outside trying to write code that would use it.
> + (or (buffer-local-value 'project-current-directory-old buf)
> + (buffer-local-value 'default-directory buf))))
...
> + (or (buffer-local-value 'project-current-directory-old buf)
> + (buffer-local-value 'default-directory buf))))
So, this part looks like what we would be paying for this solution: any
code looking to decide whether a buffer "belongs" to the project, would
have to reproduce this exact expression. Wouldn't it?
> + (setq-local project-current-directory-old default-directory)
> + (setq-local default-directory dir)
Could you explain: if we can just set these here and then clean up in
postfun, couldn't we likewise set (and then later clean up) the value of
project-current-directory-override?
> - (eq this-command command))
> + (eq this-command command)
> + (eq this-command 'other-project-prefix))
Did this part of the patch get in by accident? If it's "localized to
project.el". Or do we have further plans to "generalize" that place
somehow? Just making sure.
This bug report was last modified 1 year and 200 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.