Killing buffers whose names start with a particular string

前端 未结 6 954
太阳男子
太阳男子 2020-12-31 05:41

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

6条回答
  •  借酒劲吻你
    2020-12-31 06:21

    An alternate approach:

    (require 'cl)
    
    (defun is-useless-buffer (buffer)
      (let ((name (buffer-name buffer)))
        (and (= ?* (aref name 0))
             (not (string-match "^\\*shell\\*" name)))))
    
    (defun kill-useless-buffers ()
      (interactive)
      (loop for buffer being the buffers
            do (and (is-useless-buffer buffer) (kill-buffer buffer))))
    

提交回复
热议问题