emacs: interactively search open buffers

前端 未结 7 806
滥情空心
滥情空心 2020-12-05 07:52

Is there a way to search all the open buffers for a particular pattern?

C-s interactively searches current buffer. Similarly, is there something that searches all th

7条回答
  •  天涯浪人
    2020-12-05 08:25

    Taking a clue from Leo's comment to Bozhidar:

    (defun my-isearch-buffers ()
      "isearch multiple buffers."
      (interactive)
      (multi-isearch-buffers
       (delq nil (mapcar (lambda (buf)
                           (set-buffer buf)
                           (and (not (equal major-mode 'dired-mode))
                                (not (string-match "^[ *]" (buffer-name buf)))
                                buf))
                         (buffer-list)))))
    

    You might have to tweak the conditions inside the and to filter whatever other kinds of buffers you want to ignore.

提交回复
热议问题