bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54296: Add buffer-matching functionality


From: Lars Ingebrigtsen
Subject: bug#54296: Add buffer-matching functionality
Date: Wed, 09 Mar 2022 17:20:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Philip Kaludercic <philipk@posteo.net> writes:

> 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).

Hm...  how would this be used with display-buffer-alist, then?  (And
perhaps Martin has some comments; added to the CCs.)

> 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.

I think I'd prefer to have the parameters reversed -- the condition is a
kind of predicate, and these days we seem to prefer to have the
predicate first.

> +(defun buffer-match (buffer condition)
> +  "Return non-nil if BUFFER matches CONDITION.
> +CONDITION is is either:
> +- a regular expression, to match a buffer name,
> +- a predicate function that takes a buffer object as argument
> +  and returns non-nil if the buffer should be killed,

Killed?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]