summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-05-28 23:58:29 +0000
committerRichard M. Stallman <rms@gnu.org>1993-05-28 23:58:29 +0000
commitc273e6471eac133154ff7a472a281d7f8b52e3d1 (patch)
tree249cf3cb4c851bce09fd52696516f8107a900bb1 /src/buffer.c
parent4fdd647eb1de18c2483a061ff8ebad49b7e196db (diff)
downloademacs-c273e6471eac133154ff7a472a281d7f8b52e3d1.tar.gz
(Fgenerate_new_buffer_name): New arg IGNORE.
(Frename_buffer): Pass new arg.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 551898163f1..55598e4dd1b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -331,13 +331,16 @@ reset_buffer_local_variables (b)
rename the buffer properly. */
DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, Sgenerate_new_buffer_name,
- 1, 1, 0,
+ 1, 2, 0,
"Return a string that is the name of no existing buffer based on NAME.\n\
If there is no live buffer named NAME, then return NAME.\n\
Otherwise modify name by appending `<NUMBER>', incrementing NUMBER\n\
-until an unused name is found, and then return that name.")
- (name)
- register Lisp_Object name;
+until an unused name is found, and then return that name.\n\
+Optional second argument ignore specifies a name that is okay to use\n\
+\(if it is in the sequence to be tried)\n\
+even if a buffer with that name exists.
+ (name, ignore)
+ register Lisp_Object name, ignore;
{
register Lisp_Object gentemp, tem;
int count;
@@ -354,6 +357,9 @@ until an unused name is found, and then return that name.")
{
sprintf (number, "<%d>", ++count);
gentemp = concat2 (name, build_string (number));
+ tem = Fstring_equal (name, ignore);
+ if (!NILP (tem))
+ return gentemp;
tem = Fget_buffer (gentemp);
if (NILP (tem))
return gentemp;
@@ -536,7 +542,7 @@ This does not change the name of the visited file (if any).")
if (!NILP (tem))
{
if (!NILP (unique))
- name = Fgenerate_new_buffer_name (name);
+ name = Fgenerate_new_buffer_name (name, current_buffer->name);
else
error ("Buffer name \"%s\" is in use", XSTRING (name)->data);
}