From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#31446: 26.1; sql-interactive-mode buffer naming is broken Date: Tue, 22 May 2018 00:09:36 +1200 Message-ID: <42fe26038dde2b56636888cfbf4e37bb@webmail.orcon.net.nz> References: <83d0xti993.fsf@gnu.org> <83bmddi2ad.fsf@gnu.org> <83603lhrvw.fsf@gnu.org> <8336yoiuf4.fsf@gnu.org> <831se6hjnh.fsf@gnu.org> <83h8n1g2hm.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1526904495 31903 195.159.176.226 (21 May 2018 12:08:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 21 May 2018 12:08:15 +0000 (UTC) User-Agent: Orcon Webmail Cc: 31446@debbugs.gnu.org, fgunbin@fastmail.fm, bug-gnu-emacs , "Michael R. Mauger" To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 21 14:08:10 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 1fKjbl-0008Bo-8j for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 May 2018 14:08:09 +0200 Original-Received: from localhost ([::1]:50329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjdp-0005XT-2H for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 May 2018 08:10:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjde-0005WJ-77 for bug-gnu-emacs@gnu.org; Mon, 21 May 2018 08:10:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fKjda-0003uI-5u for bug-gnu-emacs@gnu.org; Mon, 21 May 2018 08:10:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34672) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fKjda-0003uB-3S for bug-gnu-emacs@gnu.org; Mon, 21 May 2018 08:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fKjdZ-0005nI-Ot for bug-gnu-emacs@gnu.org; Mon, 21 May 2018 08:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 May 2018 12:10: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.152690458322244 (code B ref 31446); Mon, 21 May 2018 12:10:01 +0000 Original-Received: (at 31446) by debbugs.gnu.org; 21 May 2018 12:09:43 +0000 Original-Received: from localhost ([127.0.0.1]:42569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fKjdF-0005mg-9B for submit@debbugs.gnu.org; Mon, 21 May 2018 08:09:42 -0400 Original-Received: from smtp-2.orcon.net.nz ([60.234.4.43]:35083) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fKjdD-0005mY-M6 for 31446@debbugs.gnu.org; Mon, 21 May 2018 08:09:40 -0400 Original-Received: from [10.253.37.70] (port=56525 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.86_2) (envelope-from ) id 1fKjdA-0003B4-BI; Tue, 22 May 2018 00:09:37 +1200 Original-Received: from [150.107.175.250] via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Tue, 22 May 2018 00:09:36 +1200 In-Reply-To: <83h8n1g2hm.fsf@gnu.org> X-Sender: psainty@orcon.net.nz X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- 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:146344 Archived-At: On 2018-05-21 14:35, Eli Zaretskii wrote: > Sorry, that was a stupid typo, now fixed. No error now, but there's still a bug. (eq new-name '(4)) is never true, so it falls through to (format "*SQL: %s*" new-name) when a prefix arg is supplied. I *think* we'd want (consp new-name) for that test (especially as it ought to cover multiple uses of C-u), *however* doing this then triggers error "Current buffer is not a SQL interactive buffer" in `sql-rename-buffer', as this is happening *before* the call to the :sqli-comint-func function which creates the buffer. I've briefly tested Filipp's suggestion, but that seemed to result in just *SQL* as a buffer name regardless of the prefix argument, rather than causing it to prompt for the name (however that might turn out to be sane in conjunction with the additional changes I've made below?) The following is working from initial/cursory testing, but it needs more testing/confirmation at minimum. diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 1b2cdaf5f6..45ce9154b0 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -4264,14 +4264,13 @@ sql-product-interactive product (sql-get-product-feature product :sqli-options) (cond - ((null new-name) + ((or (null new-name) + (consp 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)) (t (format "*SQL: %s*" new-name))))) @@ -4279,6 +4278,10 @@ sql-product-interactive (let ((sql-interactive-product product)) (sql-interactive-mode)) + ;; Prompt for the buffer name if a prefix argument was given. + (when (consp new-name) + (sql-rename-buffer new-name)) + ;; Set the new buffer name (setq new-sqli-buffer (current-buffer)) (set (make-local-variable 'sql-buffer) Setting just "*SQL*" initially in the case of (consp new-name) is to prevent the comint process name from ending up as, e.g., "SQL: (4)", which is particularly noticeable when exiting the process, to the message: "Process SQL: (4) finished" Comparing with Emacs 25.3, this would simply say "Process SQL finished", and using "*SQL*" in the new code appears to give this result. This bug could probably use some attention from whoever made the changes to how this was in Emacs 25, which I think was this commit: commit c5a31f8292c94d19b80a3dbe0b3026693cc1090e Author: Michael R. Mauger Date: Mon Mar 20 23:26:53 2017 -0400 Ccing Michael -- See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31446 -Phil