GNU bug report logs - #54100
29.0.50; Allow project-buffers to ignore some buffers

Previous Next

Package: emacs;

Reported by: Manuel Uberti <manuel.uberti <at> inventati.org>

Date: Tue, 22 Feb 2022 08:28:01 UTC

Severity: normal

Found in version 29.0.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #38 received at 54100 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Manuel Uberti <manuel.uberti <at> inventati.org>, 54100 <at> debbugs.gnu.org
Subject: Re: bug#54100: 29.0.50; Allow project-buffers to ignore some buffers
Date: Sat, 26 Feb 2022 03:50:47 +0200
On 25.02.2022 08:44, Manuel Uberti via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> On 25/02/22 03:33, Dmitry Gutov wrote:
>> Doesn't this mean that it won't do the (memq ... buffers) check and 
>> thus ignore the result of the (project-buffers pr) call?
>>
>> Instead, it could be a lambda like
>>
>>            (lambda (buffer)
>>              ;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist.
>>              (and (memq (cdr buffer) buffers)
>>                   (funcall predicate buffer)))
>>
>> Does that make sense?
> 
> Totally, thank you!
> 
>> (I would also try to shorten the new defcustom's docstring by 
>> referring to the existing one, but I can make that change myself.)
> 
> Done.

Very good.

Looking at it more thoroughly, though, shouldn't we simply inline the 
check added to project-switch-to-buffer to the function 
project--read-project-buffer?

It's used by two other related commands (project-display-buffer and 
project-display-buffer-other-frame), and users would probably expect 
them to have the same filtering.

project-ignore-buffer-conditions's docstring can be updated accordingly.

>> Or if you wanted to stay on "or" but make it easier for certain usage 
>> pattern, you could call the var 'project-ignore-buffer-conditions' (or 
>> "hide" or etc), and change its use appropriately. Then the value could 
>> contain
>>
>>    '((not mu-project-buffer-p)
>>      (derived-mode . comint-mode))
>>
>> ...and (not mu-project-buffer-p) could obviously be rewritten in a 
>> negated way in the function's definition.
> 
> I followed your suggestion and used `project-ignore-buffer-conditions' 
> in the attached patch.
> 
> Now everything works as expected when I use this:
> 
> (defun mu-project-ignore-buffer-p (buffer)
>    "Check if BUFFER is a member of `mu-ignored-buffers'."
>    (seq-contains-p mu-ignored-buffers (buffer-name buffer) 
> #'string-match-p))
> 
> (setq-default project-ignore-buffer-conditions '(mu-project-ignore-buffer-p
>                                                   (derived-mode . 
> dired-mode)))
> 
> 
> Again, thank you for the help on this.

No problem!




This bug report was last modified 3 years and 142 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.