aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorRichard M. Stallman1993-05-28 23:58:29 +0000
committerRichard M. Stallman1993-05-28 23:58:29 +0000
commitc273e6471eac133154ff7a472a281d7f8b52e3d1 (patch)
tree249cf3cb4c851bce09fd52696516f8107a900bb1 /src/buffer.c
parent4fdd647eb1de18c2483a061ff8ebad49b7e196db (diff)
downloademacs-c273e6471eac133154ff7a472a281d7f8b52e3d1.tar.gz
emacs-c273e6471eac133154ff7a472a281d7f8b52e3d1.zip
(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)
331 rename the buffer properly. */ 331 rename the buffer properly. */
332 332
333DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, Sgenerate_new_buffer_name, 333DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, Sgenerate_new_buffer_name,
334 1, 1, 0, 334 1, 2, 0,
335 "Return a string that is the name of no existing buffer based on NAME.\n\ 335 "Return a string that is the name of no existing buffer based on NAME.\n\
336If there is no live buffer named NAME, then return NAME.\n\ 336If there is no live buffer named NAME, then return NAME.\n\
337Otherwise modify name by appending `<NUMBER>', incrementing NUMBER\n\ 337Otherwise modify name by appending `<NUMBER>', incrementing NUMBER\n\
338until an unused name is found, and then return that name.") 338until an unused name is found, and then return that name.\n\
339 (name) 339Optional second argument ignore specifies a name that is okay to use\n\
340 register Lisp_Object name; 340\(if it is in the sequence to be tried)\n\
341even if a buffer with that name exists.
342 (name, ignore)
343 register Lisp_Object name, ignore;
341{ 344{
342 register Lisp_Object gentemp, tem; 345 register Lisp_Object gentemp, tem;
343 int count; 346 int count;
@@ -354,6 +357,9 @@ until an unused name is found, and then return that name.")
354 { 357 {
355 sprintf (number, "<%d>", ++count); 358 sprintf (number, "<%d>", ++count);
356 gentemp = concat2 (name, build_string (number)); 359 gentemp = concat2 (name, build_string (number));
360 tem = Fstring_equal (name, ignore);
361 if (!NILP (tem))
362 return gentemp;
357 tem = Fget_buffer (gentemp); 363 tem = Fget_buffer (gentemp);
358 if (NILP (tem)) 364 if (NILP (tem))
359 return gentemp; 365 return gentemp;
@@ -536,7 +542,7 @@ This does not change the name of the visited file (if any).")
536 if (!NILP (tem)) 542 if (!NILP (tem))
537 { 543 {
538 if (!NILP (unique)) 544 if (!NILP (unique))
539 name = Fgenerate_new_buffer_name (name); 545 name = Fgenerate_new_buffer_name (name, current_buffer->name);
540 else 546 else
541 error ("Buffer name \"%s\" is in use", XSTRING (name)->data); 547 error ("Buffer name \"%s\" is in use", XSTRING (name)->data);
542 } 548 }