From e0df3aef1f4fcb70e10e0004f9406eaca63f5dc4 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Fri, 7 Nov 1997 21:44:16 +0000 Subject: [PATCH] (rename-uniquely): Simplify. --- lisp/files.el | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 6054af1b4e8..fbb148322fd 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2405,20 +2405,16 @@ This function is useful for creating multiple shell process buffers or multiple mail buffers, etc." (interactive) (save-match-data - (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)) - (name (buffer-name new-buf))) - (kill-buffer new-buf) - (rename-buffer name) + (let ((base-name (buffer-name))) + (and (string-match "<[0-9]+>\\'" base-name) + (not (and buffer-file-name + (string= base-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. + (setq base-name (substring base-name 0 (match-beginning 0)))) + (rename-buffer (generate-new-buffer-name base-name)) (force-mode-line-update)))) (defun make-directory (dir &optional parents) -- 2.39.2