changeset 11553:03aaf11843d1

(rename-uniquely): Don't discard <NN> from end if that is part of the visited file name.
author Richard M. Stallman <rms@gnu.org>
date Tue, 25 Apr 1995 04:22:37 +0000
parents c20207bd74a8
children ac21a7106ffd
files lisp/files.el
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Tue Apr 25 04:09:47 1995 +0000
+++ b/lisp/files.el	Tue Apr 25 04:22:37 1995 +0000
@@ -1882,7 +1882,14 @@
 or multiple mail buffers, etc."
   (interactive)
   (save-match-data
-    (let* ((base-name (if (string-match "<[0-9]+>\\'" (buffer-name))
+    (let* ((base-name (if (and (string-match "<[0-9]+>\\'" (buffer-name))
+			       (not (and buffer-file-name
+					 (string= (buffer-name)
+						  (file-name-nondirectory
+						   buffer-file-name)))))
+			  ;; If the existing buffer name has a <NNN>,
+			  ;; which isn't part of the file name (if any),
+			  ;; then get rid of that.
 			  (substring (buffer-name) 0 (match-beginning 0))
 			(buffer-name)))
 	   (new-buf (generate-new-buffer base-name))