aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el17
1 files changed, 9 insertions, 8 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 4b745d54433..a8ef61e828d 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -921,21 +921,22 @@ If the value is nil, don't highlight the buffer names specially."
921 (when current-prefix-arg 921 (when current-prefix-arg
922 (prefix-numeric-value current-prefix-arg)))) 922 (prefix-numeric-value current-prefix-arg))))
923 923
924(defun occur-rename-buffer (&optional unique-p) 924(defun occur-rename-buffer (&optional unique-p interactive-p)
925 "Rename the current *Occur* buffer to *Occur: original-buffer-name*. 925 "Rename the current *Occur* buffer to *Occur: original-buffer-name*.
926Here `original-buffer-name' is the buffer name were occur was originally run. 926Here `original-buffer-name' is the buffer name were Occur was originally run.
927When given the prefix argument, the renaming will not clobber the existing 927When given the prefix argument, or called non-interactively, the renaming
928buffer(s) of that name, but use `generate-new-buffer-name' instead. 928will not clobber the existing buffer(s) of that name, but use
929You can add this to `occur-mode-hook' if you always want a separate *Occur* 929`generate-new-buffer-name' instead. You can add this to `occur-hook'
930buffer for each buffer where you invoke `occur'." 930if you always want a separate *Occur* buffer for each buffer where you
931 (interactive "P") 931invoke `occur'."
932 (interactive "P\np")
932 (with-current-buffer 933 (with-current-buffer
933 (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*")) 934 (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*"))
934 (rename-buffer (concat "*Occur: " 935 (rename-buffer (concat "*Occur: "
935 (mapconcat #'buffer-name 936 (mapconcat #'buffer-name
936 (car (cddr occur-revert-arguments)) "/") 937 (car (cddr occur-revert-arguments)) "/")
937 "*") 938 "*")
938 unique-p))) 939 (or unique-p (not interactive-p)))))
939 940
940(defun occur (regexp &optional nlines) 941(defun occur (regexp &optional nlines)
941 "Show all lines in the current buffer containing a match for REGEXP. 942 "Show all lines in the current buffer containing a match for REGEXP.