I'm looking for something similar to
(find-buffer-visiting FILENAME &optional PREDICATE) that would find a dired-mode buffer visiting a specified directory. Something like:
find-buffer-visiting only searches buffer visiting files quite unfortunately. It checks if the buffer has a local buffer-file-name variable bound. The optional PREDICATE is therefore used only on files.
A potential improvement for that function would be to write
(find-buffer-visiting FILENAME &optional PREDICATE FILTER) where FILTER would be a filter function used on all buffers to determine if the buffer should be included in the search.
Is there something like this already available?