From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#31446: 26.1; sql-interactive-mode buffer naming is broken Date: Fri, 18 May 2018 23:24:31 +0300 Message-ID: <8336yoiuf4.fsf@gnu.org> References: <83d0xti993.fsf@gnu.org> <83bmddi2ad.fsf@gnu.org> <83603lhrvw.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1526674985 6913 195.159.176.226 (18 May 2018 20:23:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 18 May 2018 20:23:05 +0000 (UTC) Cc: psainty@orcon.net.nz, 31446@debbugs.gnu.org To: Filipp Gunbin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 18 22:23:00 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJlu0-0001eo-DK for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 May 2018 22:23:00 +0200 Original-Received: from localhost ([::1]:40771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJlw7-0003rm-CU for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 May 2018 16:25:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJlw1-0003rW-JM for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 16:25:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJlvy-0005YH-CT for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 16:25:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60559) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJlvy-0005Y7-8U for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 16:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fJlvy-0005cl-19 for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 16:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 May 2018 20:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31446 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31446-submit@debbugs.gnu.org id=B31446.152667508521595 (code B ref 31446); Fri, 18 May 2018 20:25:01 +0000 Original-Received: (at 31446) by debbugs.gnu.org; 18 May 2018 20:24:45 +0000 Original-Received: from localhost ([127.0.0.1]:40223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJlvh-0005cF-G9 for submit@debbugs.gnu.org; Fri, 18 May 2018 16:24:45 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJlvf-0005c1-Fh for 31446@debbugs.gnu.org; Fri, 18 May 2018 16:24:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJlvX-0005NL-66 for 31446@debbugs.gnu.org; Fri, 18 May 2018 16:24:38 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJlvX-0005NH-2l; Fri, 18 May 2018 16:24:35 -0400 Original-Received: from [176.228.60.248] (port=1071 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fJlvW-0006nX-C5; Fri, 18 May 2018 16:24:34 -0400 In-reply-to: (message from Filipp Gunbin on Fri, 18 May 2018 21:03:00 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146272 Archived-At: > From: Filipp Gunbin > Cc: psainty@orcon.net.nz, 31446@debbugs.gnu.org > Date: Fri, 18 May 2018 21:03:00 +0300 > > Your patch, while it may have fixed the bug, introduces some logic on > setting buffer name - so we could get undesired behaviour change. AFAIK, the logic was already there, I just fixed it to behave more reasonably. The original code was (if (and new-name (string-prefix-p "SQL" new-name t)) new-name (concat "SQL: " new-name)))) This is now (cond ((zerop new-name) "*SQL*") ((stringp new-name) (if (string-prefix-p "SQL" new-name t) new-name (concat "*SQL: " new-name "*"))) ((eq new-name '(4)) (sql-rename-buffer new-name) sql-alternate-buffer-name) (t (format "*SQL: %s*" new-name))))) which (a) avoids concatenating a string and a list '(4); (b) avoids calling string-prefix-p with 2nd arg not a string, something that works only by sheer luck; (c) calls sql-rename-buffer to choose the buffer name, because that function implements the logic of naming the buffer, and duplicating that sounds redundant; (d) does something reasonable when new-name is neither a string nor a prefix arg nor nil. And that is the only thing that I changed.