Function: multi-occur-in-matching-buffers

multi-occur-in-matching-buffers is an interactive and byte-compiled function defined in replace.el.gz.

Signature

(multi-occur-in-matching-buffers BUFREGEXP REGEXP &optional ALLBUFS)

Documentation

Show all lines matching REGEXP in buffers specified by BUFREGEXP.

Normally BUFREGEXP matches against each buffer's visited file name, but ALLBUFS non-nil (interactively, if you specify a prefix argument), it matches against the buffer name and includes also buffers that don't visit files. See also multi-occur.

View in manual

Probably introduced at or before Emacs version 22.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/replace.el.gz
(defun multi-occur-in-matching-buffers (bufregexp regexp &optional allbufs)
  "Show all lines matching REGEXP in buffers specified by BUFREGEXP.
Normally BUFREGEXP matches against each buffer's visited file name,
but ALLBUFS non-nil (interactively, if you specify a prefix argument),
it matches against the buffer name and includes also buffers that
don't visit files.
See also `multi-occur'."
  (interactive
   (cons
    (let* ((default (car regexp-history))
	   (input
	    (read-regexp
	     (if current-prefix-arg
		 "List lines in buffers whose names match regexp: "
	       "List lines in buffers whose filenames match regexp: "))))
      (if (equal input "")
	  default
	input))
    (occur-read-primary-args)))
  (when bufregexp
    (occur-1 regexp nil
	     (delq nil
		   (mapcar (lambda (buf)
			     (when (if allbufs
				       (string-match bufregexp
						     (buffer-name buf))
				     (and (buffer-file-name buf)
					  (string-match bufregexp
							(buffer-file-name buf))))
			       buf))
			   (buffer-list))))))