diff options
author | Juanma Barranquero <lekktu@gmail.com> | 2005-07-07 10:04:01 +0000 |
---|---|---|
committer | Juanma Barranquero <lekktu@gmail.com> | 2005-07-07 10:04:01 +0000 |
commit | a653724b13498c0e355cc056823b6a272337d59f (patch) | |
tree | e1ae57d128ae0b2013e7cbf58b674c353d80daaf /lisp/replace.el | |
parent | f567c4887025a9df6bc2448f3de7427eddd3219e (diff) | |
download | emacs-a653724b13498c0e355cc056823b6a272337d59f.tar.gz |
(occur-rename-buffer): Use `generate-new-buffer' also when called
non-interactively. Doc fix.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r-- | lisp/replace.el | 17 |
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." (when current-prefix-arg (prefix-numeric-value current-prefix-arg)))) -(defun occur-rename-buffer (&optional unique-p) +(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 were occur was originally run. -When given the prefix argument, the renaming will not clobber the existing -buffer(s) of that name, but use `generate-new-buffer-name' instead. -You can add this to `occur-mode-hook' if you always want a separate *Occur* -buffer for each buffer where you invoke `occur'." - (interactive "P") +Here `original-buffer-name' is the buffer name were Occur was originally run. +When given the prefix argument, or called non-interactively, the renaming +will not clobber the existing buffer(s) of that name, but 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 #'buffer-name (car (cddr occur-revert-arguments)) "/") "*") - unique-p))) + (or unique-p (not interactive-p))))) (defun occur (regexp &optional nlines) "Show all lines in the current buffer containing a match for REGEXP. |