GNU bug report logs - #58933
28.2; project-buffers should take an optional filter

Previous Next

Package: emacs;

Reported by: Sean Devlin <spd <at> toadstyle.org>

Date: Mon, 31 Oct 2022 22:05:02 UTC

Severity: normal

Found in version 28.2

Done: Philip Kaludercic <philipk <at> posteo.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 58933 in the body.
You can then email your comments to 58933 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#58933; Package emacs. (Mon, 31 Oct 2022 22:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sean Devlin <spd <at> toadstyle.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 31 Oct 2022 22:05:02 GMT) Full text and rfc822 format available.

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

From: Sean Devlin <spd <at> toadstyle.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.2; project-buffers should take an optional filter
Date: Mon, 31 Oct 2022 18:04:38 -0400
Hi folks,

Project.el provides a function project-buffers that returns a list of
buffers associated with the given project. The list is unfiltered,
meaning any program using it will have to do some work to pick out the
buffers of interest. It would be useful if the function had an optional
argument to do this work.

Project.el already has a function project--buffer-check that validates a
buffer against a list of conditions. Maybe it should be wired into
project-buffers to do the job of filtering?

In GNU Emacs 28.2
System Description:  macOS

Configured using:
'configure --disable-silent-rules
--enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
--infodir=/opt/homebrew/Cellar/emacs/28.2/share/info/emacs
--prefix=/opt/homebrew/Cellar/emacs/28.2 --with-gnutls --without-x
--with-xml2 --without-dbus --with-modules --without-ns
--without-imagemagick --without-selinux'

Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE PDUMPER THREADS ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow regexp-opt sort mail-extr emacsbug message rmc puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util rmail tool-bar rmail-loaddefs auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json map
text-property-search time-date subr-x seq mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
term/xterm xterm byte-opt gv bytecomp byte-compile cconv iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue multi-tty
make-network-process emacs)

Memory information:
((conses 16 52996 8081)
(symbols 48 6605 1)
(strings 32 18468 1651)
(string-bytes 1 607034)
(vectors 16 10639)
(vector-slots 8 125885 7770)
(floats 8 24 265)
(intervals 56 192 0)
(buffers 992 10))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58933; Package emacs. (Tue, 01 Nov 2022 23:39:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Sean Devlin <spd <at> toadstyle.org>, 58933 <at> debbugs.gnu.org
Subject: Re: bug#58933: 28.2; project-buffers should take an optional filter
Date: Wed, 2 Nov 2022 01:38:42 +0200
Hi Sean,

On 01.11.2022 00:04, Sean Devlin wrote:

> Project.el provides a function project-buffers that returns a list of
> buffers associated with the given project. The list is unfiltered,
> meaning any program using it will have to do some work to pick out the
> buffers of interest. It would be useful if the function had an optional
> argument to do this work.
> 
> Project.el already has a function project--buffer-check that validates a
> buffer against a list of conditions. Maybe it should be wired into
> project-buffers to do the job of filtering?

There is also 'match-buffers' and 'buffer-match-p' in the core Emacs 
starting with Emacs 29 (should also be available with the 'compat' package).

What do you think about these alternatives?

We could indeed add a new argument, but perhaps it won't made as much of 
a difference, given those options.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58933; Package emacs. (Wed, 02 Nov 2022 14:18:02 GMT) Full text and rfc822 format available.

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

From: Sean Devlin <spd <at> toadstyle.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 58933 <at> debbugs.gnu.org
Subject: Re: bug#58933: 28.2; project-buffers should take an optional filter
Date: Wed, 2 Nov 2022 10:17:29 -0400
Hi Dmitry,

> On Nov 1, 2022, at 7:38 PM, Dmitry Gutov <dgutov <at> yandex.ru> wrote:
> 
> Hi Sean,
> 
> On 01.11.2022 00:04, Sean Devlin wrote:
> 
>> Project.el provides a function project-buffers that returns a list of
>> buffers associated with the given project. The list is unfiltered,
>> meaning any program using it will have to do some work to pick out the
>> buffers of interest. It would be useful if the function had an optional
>> argument to do this work.
>> Project.el already has a function project--buffer-check that validates a
>> buffer against a list of conditions. Maybe it should be wired into
>> project-buffers to do the job of filtering?
> 
> There is also 'match-buffers' and 'buffer-match-p' in the core Emacs starting with Emacs 29 (should also be available with the 'compat' package).
> 
> What do you think about these alternatives?

Thanks for the pointer—I wasn’t aware of these functions. (I’m still on 28.2.)

It looks like these do fit the bill. For example, it looks like I could write:

(match-buffers condition (project-buffers project))

I can’t see these functions in my local installation of compat (056e3cc), but maybe definitions from Emacs 29 haven’t been added yet? In any case, I’m happy to wait a little bit.

> 
> We could indeed add a new argument, but perhaps it won't made as much of a difference, given those options.

Given the functions you mentioned, I think it’s probably not a high priority to solve the problem in project.el.

Thanks!



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58933; Package emacs. (Fri, 04 Nov 2022 01:23:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Philip Kaludercic <philipk <at> posteo.net>, Sean Devlin <spd <at> toadstyle.org>
Cc: 58933 <at> debbugs.gnu.org
Subject: Re: bug#58933: 28.2; project-buffers should take an optional filter
Date: Fri, 4 Nov 2022 03:22:09 +0200
On 02.11.2022 16:17, Sean Devlin wrote:
> Hi Dmitry,
> 
>> On Nov 1, 2022, at 7:38 PM, Dmitry Gutov<dgutov <at> yandex.ru>  wrote:
>>
>> Hi Sean,
>>
>> On 01.11.2022 00:04, Sean Devlin wrote:
>>
>>> Project.el provides a function project-buffers that returns a list of
>>> buffers associated with the given project. The list is unfiltered,
>>> meaning any program using it will have to do some work to pick out the
>>> buffers of interest. It would be useful if the function had an optional
>>> argument to do this work.
>>> Project.el already has a function project--buffer-check that validates a
>>> buffer against a list of conditions. Maybe it should be wired into
>>> project-buffers to do the job of filtering?
>> There is also 'match-buffers' and 'buffer-match-p' in the core Emacs starting with Emacs 29 (should also be available with the 'compat' package).
>>
>> What do you think about these alternatives?
> Thanks for the pointer—I wasn’t aware of these functions. (I’m still on 28.2.)
> 
> It looks like these do fit the bill. For example, it looks like I could write:
> 
> (match-buffers condition (project-buffers project))
> 
> I can’t see these functions in my local installation of compat (056e3cc), but maybe definitions from Emacs 29 haven’t been added yet? In any case, I’m happy to wait a little bit.

Right, I'm not seeing it in there either. Perhaps it'll get there after 
Emacs 29 is released.

Philip, is that the plan?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58933; Package emacs. (Fri, 04 Nov 2022 06:48:02 GMT) Full text and rfc822 format available.

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

From: Philip Kaludercic <philipk <at> posteo.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Sean Devlin <spd <at> toadstyle.org>, 58933 <at> debbugs.gnu.org
Subject: Re: bug#58933: 28.2; project-buffers should take an optional filter
Date: Fri, 04 Nov 2022 06:47:11 +0000
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> On 02.11.2022 16:17, Sean Devlin wrote:
>> Hi Dmitry,
>> 
>>> On Nov 1, 2022, at 7:38 PM, Dmitry Gutov<dgutov <at> yandex.ru>  wrote:
>>>
>>> Hi Sean,
>>>
>>> On 01.11.2022 00:04, Sean Devlin wrote:
>>>
>>>> Project.el provides a function project-buffers that returns a list of
>>>> buffers associated with the given project. The list is unfiltered,
>>>> meaning any program using it will have to do some work to pick out the
>>>> buffers of interest. It would be useful if the function had an optional
>>>> argument to do this work.
>>>> Project.el already has a function project--buffer-check that validates a
>>>> buffer against a list of conditions. Maybe it should be wired into
>>>> project-buffers to do the job of filtering?
>>> There is also 'match-buffers' and 'buffer-match-p' in the core Emacs starting with Emacs 29 (should also be available with the 'compat' package).
>>>
>>> What do you think about these alternatives?
>> Thanks for the pointer—I wasn’t aware of these functions. (I’m still on 28.2.)
>> It looks like these do fit the bill. For example, it looks like I
>> could write:
>> (match-buffers condition (project-buffers project))
>> I can’t see these functions in my local installation of compat
>> (056e3cc), but maybe definitions from Emacs 29 haven’t been added
>> yet? In any case, I’m happy to wait a little bit.
>
> Right, I'm not seeing it in there either. Perhaps it'll get there
> after Emacs 29 is released.

Right, Emacs 29 support is under development, but hasn't been completed
yet: https://git.sr.ht/~pkal/compat/tree/emacs-29.1/item/compat-29.el.

> Philip, is that the plan?

The plan is to be ready by the time Emacs 29 is released.  If possible
and I get to it, it might also be released earlier, but at the very
least I'll be waiting for the feature freeze later this month.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58933; Package emacs. (Fri, 04 Nov 2022 16:42:01 GMT) Full text and rfc822 format available.

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

From: Sean Devlin <spd <at> toadstyle.org>
To: Philip Kaludercic <philipk <at> posteo.net>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 58933 <at> debbugs.gnu.org
Subject: Re: bug#58933: 28.2; project-buffers should take an optional filter
Date: Fri, 4 Nov 2022 12:40:58 -0400
[Message part 1 (text/plain, inline)]
Hi folks,

> On Nov 4, 2022, at 2:47 AM, Philip Kaludercic <philipk <at> posteo.net> wrote:
> 
> Dmitry Gutov <dgutov <at> yandex.ru <mailto:dgutov <at> yandex.ru>> writes:
> 
>> On 02.11.2022 16:17, Sean Devlin wrote:
>>> Hi Dmitry,
>>> 
>>>> On Nov 1, 2022, at 7:38 PM, Dmitry Gutov<dgutov <at> yandex.ru>  wrote:
>>>> 
>>>> Hi Sean,
>>>> 
>>>> On 01.11.2022 00:04, Sean Devlin wrote:
>>>> 
>>>>> Project.el provides a function project-buffers that returns a list of
>>>>> buffers associated with the given project. The list is unfiltered,
>>>>> meaning any program using it will have to do some work to pick out the
>>>>> buffers of interest. It would be useful if the function had an optional
>>>>> argument to do this work.
>>>>> Project.el already has a function project--buffer-check that validates a
>>>>> buffer against a list of conditions. Maybe it should be wired into
>>>>> project-buffers to do the job of filtering?
>>>> There is also 'match-buffers' and 'buffer-match-p' in the core Emacs starting with Emacs 29 (should also be available with the 'compat' package).
>>>> 
>>>> What do you think about these alternatives?
>>> Thanks for the pointer—I wasn’t aware of these functions. (I’m still on 28.2.)
>>> It looks like these do fit the bill. For example, it looks like I
>>> could write:
>>> (match-buffers condition (project-buffers project))
>>> I can’t see these functions in my local installation of compat
>>> (056e3cc), but maybe definitions from Emacs 29 haven’t been added
>>> yet? In any case, I’m happy to wait a little bit.
>> 
>> Right, I'm not seeing it in there either. Perhaps it'll get there
>> after Emacs 29 is released.
> 
> Right, Emacs 29 support is under development, but hasn't been completed
> yet: https://git.sr.ht/~pkal/compat/tree/emacs-29.1/item/compat-29.el.
> 
>> Philip, is that the plan?
> 
> The plan is to be ready by the time Emacs 29 is released.  If possible
> and I get to it, it might also be released earlier, but at the very
> least I'll be waiting for the feature freeze later this month.

That sounds good to me. I have a workaround in the meantime, so I’m happy to wait for the new release. Thanks both for your help, and feel free to close this at your discretion.

[Message part 2 (text/html, inline)]

Reply sent to Philip Kaludercic <philipk <at> posteo.net>:
You have taken responsibility. (Fri, 04 Nov 2022 17:08:02 GMT) Full text and rfc822 format available.

Notification sent to Sean Devlin <spd <at> toadstyle.org>:
bug acknowledged by developer. (Fri, 04 Nov 2022 17:08:02 GMT) Full text and rfc822 format available.

Message #25 received at 58933-done <at> debbugs.gnu.org (full text, mbox):

From: Philip Kaludercic <philipk <at> posteo.net>
To: Sean Devlin <spd <at> toadstyle.org>
Cc: 58933-done <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#58933: 28.2; project-buffers should take an optional filter
Date: Fri, 04 Nov 2022 17:07:42 +0000
Sean Devlin <spd <at> toadstyle.org> writes:

> Hi folks,
>
>> On Nov 4, 2022, at 2:47 AM, Philip Kaludercic <philipk <at> posteo.net> wrote:
>> 
>> Dmitry Gutov <dgutov <at> yandex.ru <mailto:dgutov <at> yandex.ru>> writes:
>> 
>>> On 02.11.2022 16:17, Sean Devlin wrote:
>>>> Hi Dmitry,
>>>> 
>>>>> On Nov 1, 2022, at 7:38 PM, Dmitry Gutov<dgutov <at> yandex.ru>  wrote:
>>>>> 
>>>>> Hi Sean,
>>>>> 
>>>>> On 01.11.2022 00:04, Sean Devlin wrote:
>>>>> 
>>>>>> Project.el provides a function project-buffers that returns a list of
>>>>>> buffers associated with the given project. The list is unfiltered,
>>>>>> meaning any program using it will have to do some work to pick out the
>>>>>> buffers of interest. It would be useful if the function had an optional
>>>>>> argument to do this work.
>>>>>> Project.el already has a function project--buffer-check that validates a
>>>>>> buffer against a list of conditions. Maybe it should be wired into
>>>>>> project-buffers to do the job of filtering?
>>>>> There is also 'match-buffers' and 'buffer-match-p' in the core
>>>>> Emacs starting with Emacs 29 (should also be available with the
>>>>> 'compat' package).
>>>>> 
>>>>> What do you think about these alternatives?
>>>> Thanks for the pointer—I wasn’t aware of these functions. (I’m still on 28.2.)
>>>> It looks like these do fit the bill. For example, it looks like I
>>>> could write:
>>>> (match-buffers condition (project-buffers project))
>>>> I can’t see these functions in my local installation of compat
>>>> (056e3cc), but maybe definitions from Emacs 29 haven’t been added
>>>> yet? In any case, I’m happy to wait a little bit.
>>> 
>>> Right, I'm not seeing it in there either. Perhaps it'll get there
>>> after Emacs 29 is released.
>> 
>> Right, Emacs 29 support is under development, but hasn't been completed
>> yet: https://git.sr.ht/~pkal/compat/tree/emacs-29.1/item/compat-29.el.
>> 
>>> Philip, is that the plan?
>> 
>> The plan is to be ready by the time Emacs 29 is released.  If possible
>> and I get to it, it might also be released earlier, but at the very
>> least I'll be waiting for the feature freeze later this month.
>
> That sounds good to me. I have a workaround in the meantime, so I’m
> happy to wait for the new release. 

I don't know what your workaround is, but since both functions
(buffer-match-p, match-buffers) are self-contained, you can also just
copy the current implementation into your local configuration.

>                                    Thanks both for your help, and feel
> free to close this at your discretion.

OK, done :)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58933; Package emacs. (Fri, 04 Nov 2022 17:12:02 GMT) Full text and rfc822 format available.

Message #28 received at 58933-done <at> debbugs.gnu.org (full text, mbox):

From: Sean Devlin <spd <at> toadstyle.org>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: 58933-done <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#58933: 28.2; project-buffers should take an optional filter
Date: Fri, 4 Nov 2022 13:11:07 -0400
[Message part 1 (text/plain, inline)]

> On Nov 4, 2022, at 1:07 PM, Philip Kaludercic <philipk <at> posteo.net> wrote:
> 
> Sean Devlin <spd <at> toadstyle.org <mailto:spd <at> toadstyle.org>> writes:
> 
>> Hi folks,
>> 
>>> On Nov 4, 2022, at 2:47 AM, Philip Kaludercic <philipk <at> posteo.net <mailto:philipk <at> posteo.net>> wrote:
>>> 
>>> Dmitry Gutov <dgutov <at> yandex.ru <mailto:dgutov <at> yandex.ru> <mailto:dgutov <at> yandex.ru>> writes:
>>> 
>>>> On 02.11.2022 16:17, Sean Devlin wrote:
>>>>> Hi Dmitry,
>>>>> 
>>>>>> On Nov 1, 2022, at 7:38 PM, Dmitry Gutov<dgutov <at> yandex.ru>  wrote:
>>>>>> 
>>>>>> Hi Sean,
>>>>>> 
>>>>>> On 01.11.2022 00:04, Sean Devlin wrote:
>>>>>> 
>>>>>>> Project.el provides a function project-buffers that returns a list of
>>>>>>> buffers associated with the given project. The list is unfiltered,
>>>>>>> meaning any program using it will have to do some work to pick out the
>>>>>>> buffers of interest. It would be useful if the function had an optional
>>>>>>> argument to do this work.
>>>>>>> Project.el already has a function project--buffer-check that validates a
>>>>>>> buffer against a list of conditions. Maybe it should be wired into
>>>>>>> project-buffers to do the job of filtering?
>>>>>> There is also 'match-buffers' and 'buffer-match-p' in the core
>>>>>> Emacs starting with Emacs 29 (should also be available with the
>>>>>> 'compat' package).
>>>>>> 
>>>>>> What do you think about these alternatives?
>>>>> Thanks for the pointer—I wasn’t aware of these functions. (I’m still on 28.2.)
>>>>> It looks like these do fit the bill. For example, it looks like I
>>>>> could write:
>>>>> (match-buffers condition (project-buffers project))
>>>>> I can’t see these functions in my local installation of compat
>>>>> (056e3cc), but maybe definitions from Emacs 29 haven’t been added
>>>>> yet? In any case, I’m happy to wait a little bit.
>>>> 
>>>> Right, I'm not seeing it in there either. Perhaps it'll get there
>>>> after Emacs 29 is released.
>>> 
>>> Right, Emacs 29 support is under development, but hasn't been completed
>>> yet: https://git.sr.ht/~pkal/compat/tree/emacs-29.1/item/compat-29.el.
>>> 
>>>> Philip, is that the plan?
>>> 
>>> The plan is to be ready by the time Emacs 29 is released.  If possible
>>> and I get to it, it might also be released earlier, but at the very
>>> least I'll be waiting for the feature freeze later this month.
>> 
>> That sounds good to me. I have a workaround in the meantime, so I’m
>> happy to wait for the new release. 
> 
> I don't know what your workaround is, but since both functions
> (buffer-match-p, match-buffers) are self-contained, you can also just
> copy the current implementation into your local configuration.

Right now, I’m using project--buffer-check, which does a very similar thing. Your suggestion might be better, so I don’t need to rely on a project.el-internal function. I’ll take a look. Thanks again!

> 
>>                                   Thanks both for your help, and feel
>> free to close this at your discretion.
> 
> OK, done :)

[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 03 Dec 2022 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 257 days ago.

Previous Next


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