Function: occur-rename-buffer

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

Signature

(occur-rename-buffer &optional UNIQUE-P INTERACTIVE-P)

Documentation

Rename the current *Occur* buffer to *Occur: original-buffer-name*.

Here original-buffer-name is the buffer name where Occur was originally run. If UNIQUE-P is non-nil (interactively, the prefix argument), or called non-interactively with INTERACTIVE-P nil, the renaming will not clobber the existing buffer(s) of that name, but will use generate-new-buffer-name instead. You can add this to occur-hook if you always want a separate
*Occur* buffer for each buffer where you invoke occur.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/replace.el.gz
(defun occur-rename-buffer (&optional unique-p interactive-p)
  "Rename the current *Occur* buffer to *Occur: original-buffer-name*.
Here `original-buffer-name' is the buffer name where Occur was originally run.
If UNIQUE-P is non-nil (interactively, the prefix argument), or called
non-interactively with INTERACTIVE-P nil, the renaming will not clobber
the existing buffer(s) of that name, but will use `generate-new-buffer-name'
instead.
You can add this to `occur-hook' if you always want a separate
*Occur* buffer for each buffer where you invoke `occur'."
  (interactive "P\np")
  (with-current-buffer
      (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*"))
    (rename-buffer (concat "*Occur: "
                           (mapconcat (lambda (boo)
                                        (buffer-name (if (overlayp boo)
                                                         (overlay-buffer boo)
                                                       boo)))
                                      (car (cddr occur-revert-arguments)) "/")
                           "*")
                   (or unique-p (not interactive-p)))))