GNU bug report logs -
#66649
29.1; `project-remember-projects-under' behavior doesn't match its doc
Previous Next
Reported by: Damien Cassou <damien <at> cassou.me>
Date: Fri, 20 Oct 2023 11:50:01 UTC
Severity: normal
Found in version 29.1
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 66649 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Damien Cassou <damien <at> cassou.me> writes:
> Dmitry Gutov <dgutov <at> yandex.ru> writes:
>> On 02/11/2023 21:58, Damien Cassou wrote:
>>> If I may, the code of `project-remember-projects-under' seems to suffer
>>> from a similar mismatch between the docstring and implementation when
>>> RECURSIVE is nil: only the DIR directory is tested and not "known
>>> projects below a directory DIR".
>>
>> Have you seen this problem when testing it?
>
> The patch is working perfectly find, thank you. I was talking about an
> unrelated (but similar) problem in a different function:
> `project-forget-projects-under'. My message incorrectly referred to the
> function you already fixed. Sorry for the confusion.
I don't think this is the same problem, in
`project-forget-projects-under' there is no manual recursive descent,
just some duplicated code. We could also re-write it to look like this:
[Message part 2 (text/plain, inline)]
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 95db9d0ef4c..5f1cce160b2 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1905,15 +1905,12 @@ project-forget-projects-under
forgotten projects."
(interactive "DDirectory: \nP")
(let ((count 0))
- (if recursive
- (dolist (proj (project-known-project-roots))
- (when (file-in-directory-p proj dir)
- (project-forget-project proj)
- (setq count (1+ count))))
- (dolist (proj (project-known-project-roots))
- (when (file-equal-p (file-name-directory proj) dir)
- (project-forget-project proj)
- (setq count (1+ count)))))
+ (dolist (proj (project-known-project-roots))
+ (when (if recursive
+ (file-in-directory-p proj dir)
+ (file-equal-p (file-name-directory proj) dir))
+ (project-forget-project proj)
+ (setq count (1+ count))))
(if (zerop count)
(message "No projects were forgotten")
(project--write-project-list)
[Message part 3 (text/plain, inline)]
But that would incur a branch in every iteration of `dolist'.
Either way, I'll push the first patch to master since there haven't been
any objections to that change.
This bug report was last modified 1 year and 251 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.