Subject: bug#23394: closed (Re: bug#23394: generate-new-buffer-name behaviour changed)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 30 Apr 2016 23:40:02 +0000

Your bug report

#23394: generate-new-buffer-name behaviour changed

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
23394: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23394
GNU Bug Tracking System
Contact [email-masked] with problems

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

Subject: generate-new-buffer-name behaviour changed
From: Chaitanya Koparkar <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Thu, 28 Apr 2016 06:24:08 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

In GNU Emacs 25.1.50.1 (x86_64-apple-darwin15.3.0, NS appkit-1404.34 Version 10.11.3 (Build 15D21)) of 2016-04-17 built on Chaitanyas-Macbook-Pro.localRepository revision: 3de30674d7aa79c9f366f65c9f30aec2c8963b54Windowing system distributor 'Apple', version 10.3.1404Configured using: 'configure --with-ns'
Configured features:JPEG IMAGEMAGICK NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS
Important settings:  value of $LANG: en_IN.UTF-8  locale-coding-system: utf-8-unix
Steps to reproduce:
* Start emacs and open a buffer named "*scratch*"
* Run `(generate-new-buffer-name "*scratch*")`
* The expected return value is "*scratch*<2>"   but instead it returns "*scratch*<1>"
I'm guessing, this commit introduced it, https://github.com/emacs-mirror/emacs/commit/b4c7869e5e1bb0bb33379b25ff830e721761a7bf.
Note the `++count` vs  just `count`.
This is just a guess however and it could be completely wrong.
Thanks,Chaitanya