]> git.eshelyaron.com Git - emacs.git/commitdiff
(rename-uniquely): Don't discard <NN> from end
authorRichard M. Stallman <rms@gnu.org>
Tue, 25 Apr 1995 04:22:37 +0000 (04:22 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 25 Apr 1995 04:22:37 +0000 (04:22 +0000)
if that is part of the visited file name.

lisp/files.el

index 3545a989498163fd1c2d25cb353b629c00ab64ca..13412aa8b6e1bc2e3403016a5b519b8c3fd9d9b5 100644 (file)
@@ -1882,7 +1882,14 @@ This function is useful for creating multiple shell process buffers
 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))