bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31446: 26.1; sql-interactive-mode buffer naming is broken


From: Phil Sainty
Subject: bug#31446: 26.1; sql-interactive-mode buffer naming is broken
Date: Tue, 22 May 2018 00:09:36 +1200
User-agent: Orcon Webmail

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 <address@hidden>
Date:   Mon Mar 20 23:26:53 2017 -0400

Ccing Michael -- See
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31446


-Phil






reply via email to

[Prev in Thread] Current Thread [Next in Thread]