aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>1993-11-20 01:41:51 +0000
committerRoland McGrath <[email protected]>1993-11-20 01:41:51 +0000
commitc059b5eaa119e42de43b4fad3408b58f37a49147 (patch)
treed1171c31dcbcee9a2fba8d5538db3d31d3f7cfcd /src
parent4c7e5f092db7443c32c13bf523fd74086a13fefd (diff)
(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.
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index d0e1f9a334..6b03e6d3e0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -560,7 +560,11 @@ This does not change the name of the visited file (if any).")
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))
{