Question

In xemacs, how do I kill buffers matching a certain pattern? I tried "kill-matching-buffers", but my xemacs doesn't appear to have that. What .el/.elc file do I need to load/eval-buffer to get this function?

I'd also settle for a way to sort of filter the buffer list so I can see just the buffers I want to delete, or get them next to each other via sort.

Was it helpful?

Solution

kill-matching-buffers code is as follows. You should be able to make it work with XEmacs with minimal effort.

(defun kill-matching-buffers (regexp &optional internal-too)
  "Kill buffers whose name matches the specified REGEXP.
The optional second argument indicates whether to kill internal buffers too."
  (interactive "sKill buffers matching this regular expression: \nP")
  (dolist (buffer (buffer-list))
    (let ((name (buffer-name buffer)))
      (when (and name (not (string-equal name ""))
                 (or internal-too (/= (aref name 0) ?\s))
                 (string-match regexp name))
        (kill-buffer-ask buffer)))))

And if you need definition for dolist (don't know if it is XEmacs), check cl-macs.el

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top