GNU bug report logs - #54296
Add buffer-matching functionality

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Mon, 7 Mar 2022 22:34:02 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Philip Kaludercic <philipk <at> posteo.net>
Subject: bug#54296: closed (Re: bug#54296: Add buffer-matching functionality)
Date: Fri, 15 Apr 2022 10:58:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#54296: Add buffer-matching functionality

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 54296 <at> debbugs.gnu.org.

-- 
54296: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54296
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Philip Kaludercic <philipk <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, 54296-done <at> debbugs.gnu.org
Subject: Re: bug#54296: Add buffer-matching functionality
Date: Fri, 15 Apr 2022 10:57:02 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Philip Kaludercic <philipk <at> posteo.net>
>> Cc: larsi <at> gnus.org,  54296 <at> debbugs.gnu.org
>> Date: Thu, 14 Apr 2022 08:25:58 +0000
>> 
>> >> > I suggested to "clarify" that by not providing the 'major-mode'
>> >> > predicate at all.  I still don't think I understand why it is so
>> >> > important that we should provide a special case for it.
>> >> 
>> >> It is not inherently important, it is just that if the predicate would
>> >> also be used in project.el, then compatibility would have to be broken,
>> >> as the distinction between `major-mode' and `derived-mode' exists there.
>> >
>> > Then project.el could use the predicate route, right?  It's quite a
>> > special case, AFAIU, so having a special solution is OK.
>> 
>> I have updated the commits as you recommended, and add a commit
>> deprecating the use of `derived-mode' in project.el.
>
> Thanks, LGTM.

Great!  The commits have been pushed.

-- 
	Philip Kaludercic

[Message part 3 (message/rfc822, inline)]
From: Philip Kaludercic <philipk <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Add buffer-matching functionality
Date: Mon, 07 Mar 2022 22:33:29 +0000
[Message part 4 (text/plain, inline)]
Tags: patch


Project.el currently has a small language for matching buffers, used by
project-kill-buffers and project--read-project-buffer.  As mentioned in
[0], this could be generalised, as done in the patch below.  As to what
file this should be added to, should be discussed.

Either way I would consider these functions useful and would have wanted
to use them in my own code many times before.  While difficult, it might
also be useful for things like display-buffer-alist (the issue is that
a function as a condition in display-buffer-alist has to accept two
arguments, while the proposed patch only takes one).

To match functions such as string-match, the argument of buffer-match
could be reversed so that the function can be used as a testfn to
assoc/alist-get.

<tangent>
The reason this was not immediately done when project-kill-buffers was
implemented, was that this would raise the "emacs" dependency of the
ELPA package "project" to the latest release or even the current
development version.

To solve issues like these, I have been working on "compat", a
yet-unreleased library added to GNU ELPA a while back that could be
added as a dependency to project.  That way newer functions, such as the
ones propose below could be used, without breaking ELPA compatibility.

To make this work properly in the near future, compat would have to
follow the upstream development, before a release is made.  If there is
any interest in this kind of an arrangement, I could start a thread on
emacs-devel to discuss the details.
</tangent>

[0] https://mail.gnu.org/archive/html/emacs-devel/2020-09/msg00082.html
[1] https://elpa.gnu.org/devel/compat.html


In GNU Emacs 29.0.50 (build 13, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)
 of 2022-02-24 built on viero
Repository revision: bd17fa2c7565f180cedbfa396c0b159e144178cb
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
[0001-Generalise-buffer-matching-from-project.el.patch (text/patch, attachment)]
[Message part 6 (text/plain, inline)]
-- 
	Philip Kaludercic

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

Previous Next


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