Subject: bug#39960: 28.0.50; Incompatible change to sql-add-product in Emacs 27

From: Michael Mauger <[email-masked]>
Date: Mon, 23 Mar 2020 01:20:45 +0000

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, March 13, 2020 5:53 AM, Eli Zaretskii <[email-masked]> wrote:

> Ping!
>
> > Date: Sat, 07 Mar 2020 09:43:39 +0200
> > From: Eli Zaretskii [email-masked]
> > Cc: [email-masked]
> >
> > > From: Philipp [email-masked]
> > > Date: Fri, 06 Mar 2020 23:39:16 +0100
> > > In Emacs 26, sql-add-product has the signature
> > > (sql-add-product PRODUCT DISPLAY &rest PLIST)
> > > However, in the Emacs 27 pretest the signature is now
> > > (sql-add-product PRODUCT DISPLAY &optional PLIST)
> > > Note the change from &rest to &optional. This is a breaking change that
> > > breaks all users of sql-add-product. I've found quite a few uses of the
> > > old signature in the wild,
> >
> > Thanks for reporting this.
> > Michael, could you please look into this ASAP? TIA.
> > Btw, this change of a public API is not in NEWS, AFAICT; if we decide
> > eventually on keeping the change, we should announce it in NEWS.

Sorry for the delay. The massive switch to WFH and illness concerns at home
interfered. All are fine, and I actually do get work done occasionally.

I've got the following patch to make. I assume it needs to be made to the
emacs-27 branch and corresponding patches made to master as well. If I
should only commit to master (same change is needed there) for cherry-picking
for emacs-27, let me know.

$ git diff
diff --git a/ChangeLog.3 b/ChangeLog.3
index fc41c1f7dc..e6cad9ed7c 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -1,3 +1,11 @@
+2020-03-22  Michael R. Mauger  <[email-masked]>
+
+	* lisp/progmodes/sql.el (sql-add-product): Re-correct argument
+	spec.  Previous change was due to my own stupidity; I have
+	resolved prior behavior (Bug#39960).
+	* test/lisp/progmodes/sql-tests.el (sql-test-add-product): Added
+	test to insure I don't make the same mistake again.
+
 2020-02-27  Nicolas Petton  <[email-masked]>

 	* admin/authors.el (authors-ignored-files): Fix entries.
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 400e304ecf..a04c26d276 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -2740,7 +2740,7 @@ sql-read-product
              nil 'require-match
              init 'sql-product-history init))))

-(defun sql-add-product (product display &optional plist)
+(defun sql-add-product (product display &rest plist)
   "Add support for a database product in `sql-mode'.

 Add PRODUCT to `sql-product-alist' which enables `sql-mode' to
diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el
index d6f89341be..91805ab725 100644
--- a/test/lisp/progmodes/sql-tests.el
+++ b/test/lisp/progmodes/sql-tests.el
@@ -187,13 +187,19 @@ sql-test-add-product
       (sql-add-product 'xyz "XyzDb")

       (should (equal (pp-to-string (assoc 'xyz sql-product-alist))
-                     "(xyz :name \"XyzDb\")\n"))))
+                     "(xyz :name \"XyzDb\")\n")))
+
+  (sql-test-product-feature-harness
+      (sql-add-product 'stu "StuDb" :X 1 :Y "2")
+
+      (should (equal (pp-to-string (assoc 'stu sql-product-alist))
+                     "(stu :name \"StuDb\" :X 1 :Y \"2\")\n"))))

 (ert-deftest sql-test-add-existing-product ()
   "Add a product that already exists."

   (sql-test-product-feature-harness
-      (should-error (sql-add-feature 'a "Aaa"))
+      (should-error (sql-add-product 'a "Aaa"))
       (should (equal (pp-to-string (assoc 'a sql-product-alist))
                      "(a :X 1 :Y 2 :Z sql-test-feature-value-a)\n"))))

--
[email-masked] // FSF and EFF member // GNU Emacs sql.el maintainer