Subject: Re: bug#23394: generate-new-buffer-name behaviour changed
From: Paul Eggert <[email-masked]>
To: Chaitanya Koparkar <[email-masked]>
Cc: Glenn Morris <[email-masked]>, [email-masked]
Date: Sat, 30 Apr 2016 16:38:59 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks for reporting the bug. I installed the attached patch to fix the typo.
From 9f2c5f395113abcfe556eabd3417e034df653ad4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sat, 30 Apr 2016 16:36:36 -0700
Subject: [PATCH] Fix generate-new-buffer-name increment typo

Problem reported by Chaitanya Koparkar (Bug#23394).
* src/buffer.c (Fgenerate_new_buffer_name): Increment count when
generating a new buffer.  This fixes a typo I introduced in
2014-04-05T00:04:[email-masked].
---
 src/buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/buffer.c b/src/buffer.c
index e0fbab6..06467d2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1077,7 +1077,7 @@ is first appended to NAME, to speed up finding a non-existent buffer.  */)
     {
       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.5.5