Subject: bug#41868: [PATCH] Add project-clean-up command

From: "Basil L. Contovounesios" <[email-masked]>
Date: Mon, 15 Jun 2020 12:38:38 +0100

"Philip K." <[email-masked]> writes:

> Thanks for the notes, just a few questions/justifications below:
>
> "Basil L. Contovounesios" <[email-masked]> writes:
>
>>> +        (when (file-in-directory-p true root)
>>> +          (push buf bufs))))
>>> +    bufs))
>>
>> Maybe the list should be returned in the same order as (buffer-list), by
>> using either nreverse or seq-filter?
>
> Is there any benifit to this, or is this just a matter of not disrupting
> expectations? My thought was that this was more like a set than a proper
> list (despite the function name).

I just thought it might be more natural to process buffers in their
usual order, in case it makes a difference in any kill-buffer-related
hooks.  It probably doesn't matter much.

>>> +    (dolist (buf (project--list-buffers pr))
>>> +      (let ((match (mapcar (lambda (re)
>>> +                             (and (string-match-p re (buffer-name buf)) t))
>>> +                           project-dont-clean-regexps)))
>>> +        (unless (memq t match)
>>> +          (kill-buffer buf))))))
>>
>> Nit: AKA
>>
>>   (unless (seq-some (lambda (re)
>>                       (string-match-p re (buffer-name buf)))
>>                     project-dont-clean-regexps)
>>     ...)
>
> Would this require adding a "(require 'seq)" to the top? I always kind
> of hesistate in adding new dependencies in patches, but if it's already
> loaded, it would look better this way.

A lot of seq.el functions are autoloaded, including seq-some.

Thanks,

-- 
Basil