Here\'s my problem: I use Emacs and get lots of buffers that are pretty useless all the time, like *Messages* or *Completions*.
I want to bind \\C-y to close all buf
I found kill-matching-functions
prompted me for unmodified buffers, which isn't what I wanted. The function below will kill buffers matching a prefix (as in the title of the question). Not exactly what you wanted, but maybe people like me who come here from Google will find this useful.
(require 'cl)
(defun kill-buffers-with-prefix (prefix)
"Kill buffers whose names start with the given prefix"
(interactive "sPrefix to kill: ")
(loop for buffer in (buffer-list)
do (if (string-prefix-p prefix (buffer-name buffer))
(kill-buffer buffer))))