From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: strange generate-new-buffer-name behaviour Date: Sat, 11 Dec 2010 21:46:44 -0500 Message-ID: <670D047F-0ECC-4A62-94AE-A3AE327885A1@raeburn.org> References: <52D2F6B8-0C31-4F82-9804-947D1BA7E82E@raeburn.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: multipart/alternative; boundary=Apple-Mail-4-282191860 X-Trace: dough.gmane.org 1292122024 4681 80.91.229.12 (12 Dec 2010 02:47:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 12 Dec 2010 02:47:04 +0000 (UTC) Cc: Emacs Dev To: Alin Soare Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 12 03:47:00 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PRbxj-000639-KZ for ged-emacs-devel@m.gmane.org; Sun, 12 Dec 2010 03:46:59 +0100 Original-Received: from localhost ([127.0.0.1]:57480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRbxd-0000v0-Jo for ged-emacs-devel@m.gmane.org; Sat, 11 Dec 2010 21:46:53 -0500 Original-Received: from [140.186.70.92] (port=57419 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRbxZ-0000ul-2b for emacs-devel@gnu.org; Sat, 11 Dec 2010 21:46:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PRbxY-0004Os-3M for emacs-devel@gnu.org; Sat, 11 Dec 2010 21:46:48 -0500 Original-Received: from mail-vw0-f41.google.com ([209.85.212.41]:49483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PRbxX-0004OX-VB for emacs-devel@gnu.org; Sat, 11 Dec 2010 21:46:48 -0500 Original-Received: by vws10 with SMTP id 10so2913944vws.0 for ; Sat, 11 Dec 2010 18:46:47 -0800 (PST) Original-Received: by 10.220.181.71 with SMTP id bx7mr750368vcb.155.1292122007005; Sat, 11 Dec 2010 18:46:47 -0800 (PST) Original-Received: from [10.0.0.158] (c-24-128-190-224.hsd1.ma.comcast.net [24.128.190.224]) by mx.google.com with ESMTPS id e18sm1145020vcf.36.2010.12.11.18.46.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 11 Dec 2010 18:46:46 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.1082) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133617 Archived-At: --Apple-Mail-4-282191860 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Dec 11, 2010, at 17:53, Alin Soare wrote: >=20 > > (generate-new-buffer-name "foo") > > =3D> "foo<5>" > > (generate-new-buffer-name "foo" "foo<3>") > > =3D> "foo<3>" > > (generate-new-buffer-name "foo" "foo<6>") > > =3D> "foo<5>" > > > > However, for me all these forms evaluate to "foo" >=20 > This might be obvious, but: Do you actually have existing buffers = named "foo", "foo<2>", "foo<3>", and "foo<4>" as described in the = paragraph before that example code? >=20 > I did not create the buffers with the given names. Then that explains why you're getting different results. The function = gives you back "foo" if that buffer doesn't exist, or finds a number to = append so that it doesn't match the name of an existing buffer. The = text before the example explains how it assumes some of those buffers = already exist. Ken= --Apple-Mail-4-282191860 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii
On Dec 11, 2010, at 17:53, Alin Soare wrote:

>           (generate-new-buffer-name "foo")
>                => "foo<5>"
>           (generate-new-buffer-name "foo" "foo<3>")
>                => "foo<3>"
>           (generate-new-buffer-name "foo" "foo<6>")
>                => "foo<5>"
>
> However, for me all these forms evaluate to "foo"

This might be obvious, but: Do you actually have existing buffers named "foo", "foo<2>", "foo<3>", and "foo<4>" as described in the paragraph before that example code?

I did not create the buffers with the given names.

Then that explains why you're getting different results.  The function gives you back "foo" if that buffer doesn't exist, or finds a number to append so that it doesn't match the name of an existing buffer.  The text before the example explains how it assumes some of those buffers already exist.

Ken
--Apple-Mail-4-282191860--