From: Paul Eggert Date: Sun, 1 May 2016 00:50:17 +0000 (-0700) Subject: Fix the buffer-count patch (Bug#23394) X-Git-Tag: emacs-26.0.90~2041 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4d9e34e02c11b05b075ada241ef93f458f486fe5;p=emacs.git Fix the buffer-count patch (Bug#23394) * src/buffer.c (Fgenerate_new_buffer_name): Increment count just once each time through the loop. Reported by Lars Ingebrigtsen in: http://lists.gnu.org/archive/html/emacs-devel/2016-04/msg00918.html --- diff --git a/src/buffer.c b/src/buffer.c index 06467d2cdc4..55a16b237e5 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1073,11 +1073,11 @@ is first appended to NAME, to speed up finding a non-existent buffer. */) return genbase; } - for (ptrdiff_t count = 1; ; count++) + for (ptrdiff_t count = 2; ; count++) { char number[INT_BUFSIZE_BOUND (ptrdiff_t) + sizeof "<>"]; AUTO_STRING_WITH_LEN (lnumber, number, - sprintf (number, "<%"pD"d>", ++count)); + sprintf (number, "<%"pD"d>", count)); Lisp_Object gentemp = concat2 (genbase, lnumber); if (!NILP (Fstring_equal (gentemp, ignore)) || NILP (Fget_buffer (gentemp)))