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 12:49:28 +0300 Message-ID: <83d0xti993.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1526636894 32150 195.159.176.226 (18 May 2018 09:48:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 18 May 2018 09:48:14 +0000 (UTC) Cc: 31446@debbugs.gnu.org To: Phil Sainty Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 18 11:48:09 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 1fJbzd-0008Cx-CZ for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 May 2018 11:48:09 +0200 Original-Received: from localhost ([::1]:37750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJc1j-0001xT-Rq for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 May 2018 05:50:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJc1W-0001vs-Ss for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 05:50:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJc1S-00056S-Su for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 05:50:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59489) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJc1S-000566-Ok for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 05:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fJc1S-0003EW-HD for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 05:50: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 09:50:02 +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.152663698412400 (code B ref 31446); Fri, 18 May 2018 09:50:02 +0000 Original-Received: (at 31446) by debbugs.gnu.org; 18 May 2018 09:49:44 +0000 Original-Received: from localhost ([127.0.0.1]:39153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJc1A-0003Dw-AN for submit@debbugs.gnu.org; Fri, 18 May 2018 05:49:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52941) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJc18-0003Dk-7l for 31446@debbugs.gnu.org; Fri, 18 May 2018 05:49:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJc0z-0004eK-6B for 31446@debbugs.gnu.org; Fri, 18 May 2018 05:49:37 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJc0z-0004eE-1r; Fri, 18 May 2018 05:49:33 -0400 Original-Received: from [176.228.60.248] (port=4153 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fJc0x-0001Pj-PA; Fri, 18 May 2018 05:49:32 -0400 In-reply-to: (message from Phil Sainty on Mon, 14 May 2018 17:54:52 +1200) 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:146249 Archived-At: > Date: Mon, 14 May 2018 17:54:52 +1200 > From: Phil Sainty > > Depending on whether/how many C-u prefix arguments I supply to > sql-postgres, the resulting buffer name is bad. > > M-x sql-postgres: "*SQL: *" > C-u M-x sql-postgres: "*SQL: ^D*" > C-u C-u M-x sql-postgres: "*SQL: ^P*" > > I've converted them for the bug report, but the ^D and ^P are actual > control characters, which I observe are characters 4 and 16 > respectively, and therefore are a match for the numeric value of the > supplied prefix argument. This is surely not what was intended. I cannot use SQL here; does the patch below give good results? diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index e4db6cc..dd96810 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -4263,9 +4263,17 @@ sql-product-interactive (funcall (sql-get-product-feature product :sqli-comint-func) product (sql-get-product-feature product :sqli-options) - (if (and new-name (string-prefix-p "SQL" new-name t)) - new-name - (concat "SQL: " new-name)))) + (when new-name + (cond + ((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)))))) ;; Set SQLi mode. (let ((sql-interactive-product product))