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

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 08 Nov 2023 21:18:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
66649: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66649
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#66649: 29.1; `project-remember-projects-under' behavior doesn't match its doc
From: Dmitry Gutov <[email-masked]>
To: Damien Cassou <[email-masked]>
Cc: [email-masked], "Philip K." <[email-masked]>
Date: Wed, 8 Nov 2023 23:16:15 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

On 08/11/2023 23:13, Damien Cassou wrote:
> Dmitry Gutov<[email-masked]>  writes:
>> Damien, is there anything else here to do?
>>
>> Did you perhaps also (or instead) saw a problem with either of the
>> docstrings? I'm not sure if I understood the last complaint correctly.
> 
> The bug can be closed, no problem.
> 
> Thanks everyone for your great work.

Thanks for reporting!

Subject: 29.1; `project-remember-projects-under' behavior doesn't match its doc
From: Damien Cassou <[email-masked]>
To: [email-masked]
Cc: Dmitry Gutov <[email-masked]>
Date: Fri, 20 Oct 2023 13:48:04 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

the documentation of `project-remember-projects-under' is:

      "Index all projects below a directory DIR.  If RECURSIVE is
    non-nil, recurse into all subdirectories to find more projects.
    After finishing, a message is printed summarizing the progress.  The
    function returns the number of detected projects."

Regardless of the value of RECURSIVE, I understand from the above that
all child directories of the DIR argument will be investigated. The doc
doesn't say anything about investigating if DIR is itself a project or
not so I think it would make sense if the function wasn't.

But the code says otherwise (as far as I understand it):

(defun project-remember-projects-under (dir &optional recursive)
  (let ((queue (list dir)))
    ;; …
    (while queue
      (when-let ((subdir (pop queue))
                 ((file-directory-p subdir)))
        ;; maybe register `subdir' as a project
        ;; …
        (when (and recursive (file-directory-p subdir))
          (setq queue (nconc (directory-files subdir …) queue)))))))

The code above seems to investigate DIR first and, if RECURSIVE is
non-nil, look at the directories below it.

Also, the second check (file-directory-p subdir) seems unnecessary
because of the first one.

There is a part of the code I don't understand:

  (unless (eq recursive 'in-progress)

It seems nowhere in the code nor in the documentation do we say anything
about this 'in-progress special value. Is it a left over from a previous
(recursive) version of the algorithm?

Best

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill