From: Richard M. Stallman Date: Tue, 25 Apr 1995 04:22:37 +0000 (+0000) Subject: (rename-uniquely): Don't discard from end X-Git-Tag: emacs-19.34~4305 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ed34f320f2b590138d1cc705aae573a9aa975639;p=emacs.git (rename-uniquely): Don't discard from end if that is part of the visited file name. --- diff --git a/lisp/files.el b/lisp/files.el index 3545a989498..13412aa8b6e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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 , + ;; 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))