From 4d9e34e02c11b05b075ada241ef93f458f486fe5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 30 Apr 2016 17:50:17 -0700 Subject: [PATCH] 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 --- src/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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))) -- 2.39.2