GNU bug report logs - #31446
26.1; sql-interactive-mode buffer naming is broken

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Mon, 14 May 2018 05:56:02 UTC

Severity: normal

Found in version 26.1

Done: Michael Mauger <mmauger <at> protonmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 31446 <at> debbugs.gnu.org
Subject: bug#31446: 26.1; sql-interactive-mode buffer naming is broken
Date: Fri, 18 May 2018 12:49:28 +0300
> Date: Mon, 14 May 2018 17:54:52 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
> 
> 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))




This bug report was last modified 6 years and 26 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.