changeset 5075:8deb7113bbdf

(Frename_buffer): When the current buffer is already named NAME, don't short-circuit and just return unless UNIQUE is nil. This makes passing UNIQUE=t equivalent to (rename-buffer (generate-new-buffer-name NAME)). This is useful way to rename the buffer automatically so you can create another with the original name.
author Roland McGrath <roland@gnu.org>
date Sat, 20 Nov 1993 01:41:51 +0000
parents bbc2accd226a
children b724b2f0fbc7
files src/buffer.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Sat Nov 20 01:31:19 1993 +0000
+++ b/src/buffer.c	Sat Nov 20 01:41:51 1993 +0000
@@ -560,7 +560,11 @@
 
   CHECK_STRING (name, 0);
   tem = Fget_buffer (name);
-  if (XBUFFER (tem) == current_buffer)
+  /* Don't short-circuit if UNIQUE is t.  That is a useful way to rename
+     the buffer automatically so you can create another with the original name.
+     It makes UNIQUE equivalent to
+     (rename-buffer (generate-new-buffer-name NAME)).  */
+  if (NILP (unique) && XBUFFER (tem) == current_buffer)
     return current_buffer->name;
   if (!NILP (tem))
     {