1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-30 19:53:09 +00:00

(occur-rename-buffer): Use `generate-new-buffer' also when called

non-interactively.  Doc fix.
This commit is contained in:
Juanma Barranquero 2005-07-07 10:04:01 +00:00
parent f567c48870
commit a653724b13
2 changed files with 17 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2005-07-07 Juanma Barranquero <lekktu@gmail.com>
* replace.el (occur-rename-buffer): Use `generate-new-buffer' also
when called non-interactively. Doc fix.
2005-07-07 Lute Kamstra <lute@gnu.org>
* elide-head.el (elide-head-headers-to-hide): Recognize the FSF's
@ -11,13 +16,13 @@
ascii-incompatible.
(set-keyboard-coding-system): Likewise.
* international/mule-cmds.el (set-default-coding-systems): Don't
set default-file-name-coding-system and
* international/mule-cmds.el (set-default-coding-systems):
Don't set default-file-name-coding-system and
default-keyboard-coding-system if coding-system is
ASCII-incompatible.
* international/utf-16.el: Declare that all UTF-16-based coding
systems ASCII-incompatible.
systems are ASCII-incompatible.
2005-07-07 Nick Roberts <nickrob@snap.net.nz>

View File

@ -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.