# HG changeset patch # User Richard M. Stallman # Date 738633509 0 # Node ID bc4beddaf2c7f291bb819d08c20b308a9f67d516 # Parent 1544ad5c9f99e837d1485ee6e6670cc0744b2599 (Fgenerate_new_buffer_name): New arg IGNORE. (Frename_buffer): Pass new arg. diff -r 1544ad5c9f99 -r bc4beddaf2c7 src/buffer.c --- a/src/buffer.c Fri May 28 23:57:33 1993 +0000 +++ b/src/buffer.c Fri May 28 23:58:29 1993 +0000 @@ -331,13 +331,16 @@ 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 `', 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 @@ { 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 @@ 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); }