Function: multi-occur

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

Signature

(multi-occur BUFS REGEXP &optional NLINES)

Documentation

Show all lines in buffers BUFS containing a match for REGEXP.

Optional argument NLINES specifies the number of context lines to show with each match, see list-matching-lines-default-context-lines. This function acts on multiple buffers; otherwise, it is exactly like occur. When you invoke this command interactively, you must specify the buffer names that you want, one by one. See also multi-occur-in-matching-buffers.

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 (bufs regexp &optional nlines)
  "Show all lines in buffers BUFS containing a match for REGEXP.
Optional argument NLINES specifies the number of context lines to show
with each match, see `list-matching-lines-default-context-lines'.
This function acts on multiple buffers; otherwise, it is exactly like
`occur'.  When you invoke this command interactively, you must specify
the buffer names that you want, one by one.
See also `multi-occur-in-matching-buffers'."
  (interactive
   (cons
    (let* ((bufs (list (read-buffer "First buffer to search: "
				    (current-buffer) t)))
	   (buf nil)
	   (ido-ignore-item-temp-list bufs))
      (while (not (string-equal
		   (setq buf (read-buffer (multi-occur--prompt) nil t))
		   ""))
	(cl-pushnew buf bufs)
	(setq ido-ignore-item-temp-list bufs))
      (nreverse (mapcar #'get-buffer bufs)))
    (occur-read-primary-args)))
  (occur-1 regexp nlines bufs))