unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Damien Cassou <damien@cassou.me>, 66649@debbugs.gnu.org
Subject: bug#66649: 29.1; `project-remember-projects-under' behavior doesn't match its doc
Date: Wed, 08 Nov 2023 19:58:43 +0000	[thread overview]
Message-ID: <87wmusow3w.fsf@posteo.net> (raw)
In-Reply-To: <c70c2594-35b1-0c14-b98b-e517b5333cbd@yandex.ru> (Dmitry Gutov's message of "Wed, 8 Nov 2023 21:56:57 +0200")

Dmitry Gutov <dgutov@yandex.ru> 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?





  reply	other threads:[~2023-11-08 19:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 11:48 bug#66649: 29.1; `project-remember-projects-under' behavior doesn't match its doc Damien Cassou
2023-10-20 15:46 ` 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 [this message]
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=87wmusow3w.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=66649@debbugs.gnu.org \
    --cc=damien@cassou.me \
    --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).