You can use M-x ibuffer which I recommend binding to C-xC-b to replace the default (or whatever binding you prefer).
Use %m to mark buffers by matching a regexp against the displayed mode-name (e.g. Emacs-Lisp). Then use D to kill the marked buffers.
"notmuch-" or "[Notmuch]"
Note that, as we're dealing with regexps, you would need to ...
You can do this with Helm
by entering a partial major-mode name prefixed with *. For example: *lisp, *sh etc. You can also use negation, e.g. !*org
to narrow down all non-Org mode buffers, or specify multiple
major modes, e.g. *!lisp,!sh,!fun etc.
Then press M-a to mark those buffers and M-D to kill them.
For example, to kill all dired buffers:
In this particular case, C-u M-x shell helps by giving each shell buffer a unique name, using a counter that increments every time.
If you want to give them more meaningful names, M-x rename-buffer RET foo RET will do the deed.
I think you have to write a tiny bit of Lisp. Type the following into M-: (M-x eval-expression). You don't need line breaks, they're just for readability.
(with-current-buffer "name of buffer"
(let (kill-buffer-hook kill-buffer-query-functions)
In general, if you don't know the exact name of the buffer, you need to call buffer-list to obtain the list of buffers and filter the result to only act on the desired buffer(s).
(defun erase-buffers-matching (regexp)
"Erase the content of all buffers whose name matches REGEXP."
(interactive "sErase buffers matching: ")
They're "visited" in the order given, and the buffer list you see sorts them (by default) by order of "recency".
But you can sort them some other way, such as alphabetically: move the cursor into the column of buffer names and press S to sort them by their name.
I found this solution in the following way:
- C-h m showed me the description of buffer-menu-...
When you have moved to the buffer-list (made it active), press g. This will update this buffer and the buffers that have already been deleted will disappear from the list, just the list does not automatically update when you call it, but it shows it is already open