Mercurial > emacs
changeset 11522:5177611e8e4d
(rename-uniquely): Strip suffix before rename.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 24 Apr 1995 14:59:22 +0000 |
parents | d580a6f682b5 |
children | fa1abeedc2d0 |
files | lisp/files.el |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/files.el Mon Apr 24 11:51:28 1995 +0000 +++ b/lisp/files.el Mon Apr 24 14:59:22 1995 +0000 @@ -1881,11 +1881,15 @@ This function is useful for creating multiple shell process buffers or multiple mail buffers, etc." (interactive) - (let* ((new-buf (generate-new-buffer (buffer-name))) - (name (buffer-name new-buf))) - (kill-buffer new-buf) - (rename-buffer name) - (set-buffer-modified-p (buffer-modified-p)))) ; force mode line update + (save-match-data + (let* ((base-name (if (string-match "<[0-9]+>\\'" (buffer-name)) + (substring (buffer-name) 0 (match-beginning 0)) + (buffer-name))) + (new-buf (generate-new-buffer base-name)) + (name (buffer-name new-buf))) + (kill-buffer new-buf) + (rename-buffer name) + (set-buffer-modified-p (buffer-modified-p))))) ; force mode line update (defun make-directory (dir &optional parents) "Create the directory DIR and any nonexistent parent dirs.