aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorRoland McGrath1993-11-20 01:41:51 +0000
committerRoland McGrath1993-11-20 01:41:51 +0000
commitc059b5eaa119e42de43b4fad3408b58f37a49147 (patch)
treed1171c31dcbcee9a2fba8d5538db3d31d3f7cfcd /src/buffer.c
parent4c7e5f092db7443c32c13bf523fd74086a13fefd (diff)
downloademacs-c059b5eaa119e42de43b4fad3408b58f37a49147.tar.gz
emacs-c059b5eaa119e42de43b4fad3408b58f37a49147.zip
(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/buffer.c')
-rw-r--r--src/buffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index d0e1f9a3347..6b03e6d3e0c 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).")
560 560
561 CHECK_STRING (name, 0); 561 CHECK_STRING (name, 0);
562 tem = Fget_buffer (name); 562 tem = Fget_buffer (name);
563 if (XBUFFER (tem) == current_buffer) 563 /* Don't short-circuit if UNIQUE is t. That is a useful way to rename
564 the buffer automatically so you can create another with the original name.
565 It makes UNIQUE equivalent to
566 (rename-buffer (generate-new-buffer-name NAME)). */
567 if (NILP (unique) && XBUFFER (tem) == current_buffer)
564 return current_buffer->name; 568 return current_buffer->name;
565 if (!NILP (tem)) 569 if (!NILP (tem))
566 { 570 {