921 |
(when current-prefix-arg |
(when current-prefix-arg |
922 |
(prefix-numeric-value current-prefix-arg)))) |
(prefix-numeric-value current-prefix-arg)))) |
923 |
|
|
924 |
(defun occur-rename-buffer (&optional unique-p) |
(defun occur-rename-buffer (&optional unique-p interactive-p) |
925 |
"Rename the current *Occur* buffer to *Occur: original-buffer-name*. |
"Rename the current *Occur* buffer to *Occur: original-buffer-name*. |
926 |
Here `original-buffer-name' is the buffer name were occur was originally run. |
Here `original-buffer-name' is the buffer name were Occur was originally run. |
927 |
When given the prefix argument, the renaming will not clobber the existing |
When given the prefix argument, or called non-interactively, the renaming |
928 |
buffer(s) of that name, but use `generate-new-buffer-name' instead. |
will not clobber the existing buffer(s) of that name, but use |
929 |
You can add this to `occur-mode-hook' if you always want a separate *Occur* |
`generate-new-buffer-name' instead. You can add this to `occur-hook' |
930 |
buffer for each buffer where you invoke `occur'." |
if you always want a separate *Occur* buffer for each buffer where you |
931 |
(interactive "P") |
invoke `occur'." |
932 |
|
(interactive "P\np") |
933 |
(with-current-buffer |
(with-current-buffer |
934 |
(if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*")) |
(if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*")) |
935 |
(rename-buffer (concat "*Occur: " |
(rename-buffer (concat "*Occur: " |
936 |
(mapconcat #'buffer-name |
(mapconcat #'buffer-name |
937 |
(car (cddr occur-revert-arguments)) "/") |
(car (cddr occur-revert-arguments)) "/") |
938 |
"*") |
"*") |
939 |
unique-p))) |
(or unique-p (not interactive-p))))) |
940 |
|
|
941 |
(defun occur (regexp &optional nlines) |
(defun occur (regexp &optional nlines) |
942 |
"Show all lines in the current buffer containing a match for REGEXP. |
"Show all lines in the current buffer containing a match for REGEXP. |