unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Damien Cassou <damien@cassou.me>
To: 66649@debbugs.gnu.org
Cc: Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#66649: 29.1; `project-remember-projects-under' behavior doesn't match its doc
Date: Fri, 20 Oct 2023 13:48:04 +0200	[thread overview]
Message-ID: <87v8b18qh7.fsf@cassou.me> (raw)

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





             reply	other threads:[~2023-10-20 11:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 11:48 Damien Cassou [this message]
2023-10-20 15:46 ` bug#66649: 29.1; `project-remember-projects-under' behavior doesn't match its doc Dmitry Gutov
2023-11-01 13:12   ` Philip Kaludercic
2023-11-01 19:04     ` Dmitry Gutov
2023-11-01 21:36       ` Philip Kaludercic
2023-11-01 22:39         ` Dmitry Gutov
2023-11-02 19:58           ` Damien Cassou
2023-11-02 20:41             ` Dmitry Gutov
2023-11-03 13:00               ` Damien Cassou
2023-11-08  8:13                 ` Philip Kaludercic
2023-11-08 19:56                   ` Dmitry Gutov
2023-11-08 19:58                     ` Philip Kaludercic
2023-11-08 20:16                       ` Dmitry Gutov
2023-11-08 21:13                         ` Damien Cassou
2023-11-08 21:16                           ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8b18qh7.fsf@cassou.me \
    --to=damien@cassou.me \
    --cc=66649@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).