Subject: Re: bug#66649: 29.1; `project-remember-projects-under' behavior doesn't match its doc

From: Philip Kaludercic <[email-masked]>
Date: Wed, 08 Nov 2023 19:58:43 +0000

Dmitry Gutov <[email-masked]> writes:

> On 08/11/2023 10:13, Philip Kaludercic wrote:
>> 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:
>> 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)
>> But that would incur a branch in every iteration of `dolist'.
>
> LGTM too. The branch-per-iteration is unlikely to move a needle in any
> realistic scenario.
>
> Up to you, whether to install this or keep the original version.

I don't see a need, this is basically an aesthetic change.  Should we
close the bug report?