From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73412: 31.0.50; Improve sql-read-product Date: Sat, 21 Sep 2024 16:32:16 +0200 Message-ID: <874j69nklr.fsf@gmx.net> Reply-To: Stephen Berman Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19619"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 73412@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 21 16:33:07 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ss1AY-0004ul-Ry for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 21 Sep 2024 16:33:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ss1AC-0006sk-CD; Sat, 21 Sep 2024 10:32:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ss1AA-0006sS-Qk for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 10:32:42 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ss1AA-0001uq-I3 for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 10:32:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=8AsaJ1mViWuZvRs1kd94ELs+WW/u5zDTsDZdC5Y84s0=; b=GzBM//VEilFZvMEjEzgj6kb6wwh50h3A/UePiw8X9hervcB67omWT7huvGuE8aEXBMvenajm0G7//xY90v+R8NQXc/Z+GB+62ME4Pqf/LDWqRWvcmViP0nZsxnjS5XyxBNcpV7QewdFCiyB2Rsp2JsITbvvtDlrXjt4Qse5aF8PHE5eMFADWyz12RjUHjNCizBWASeWYFrHxuyhc51wi1jzu5hVu++XtL2jxb0kwHmgz2JRcl6vButF6EzHVgYmk+q0IzlLNKkWh0idQKCe3NuLCzSPnTCIfdlBNShKP2yplPfVlC63PDm6mExbBBKjm5vfJKurrLWI8/1JaElKzhQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ss1AU-0003UD-Pc for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 10:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Sep 2024 14:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73412 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.172692916413353 (code B ref -1); Sat, 21 Sep 2024 14:33:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Sep 2024 14:32:44 +0000 Original-Received: from localhost ([127.0.0.1]:40118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ss1AB-0003TI-CZ for submit@debbugs.gnu.org; Sat, 21 Sep 2024 10:32:43 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:56810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ss1A9-0003T9-Dn for submit@debbugs.gnu.org; Sat, 21 Sep 2024 10:32:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ss19o-0006ZE-D1 for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 10:32:20 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ss19m-0001pg-MG for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 10:32:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1726929137; x=1727533937; i=stephen.berman@gmx.net; bh=8AsaJ1mViWuZvRs1kd94ELs+WW/u5zDTsDZdC5Y84s0=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:MIME-Version: Content-Type:cc:content-transfer-encoding:content-type:date:from: message-id:mime-version:reply-to:subject:to; b=ESQ9k+muzYVM2aeWkF4TtCdL40401Hqdv9rpgHLPsReKjhjApCYD+WJqbKy2C0U0 KVFDrQkw40z1bgB9ZtJd3t1Mhdm9o1J3GN+YXyRD3ySFneySKU8D+az2kmdRiHSiQ OW3p1+/DxChfgS5R3eTfTgwjsqbJvyiYojmdXVEb51Pd4Z/4xU+z5cVj7gADtMuhG BRgiLCxol0XGnQj/hUMM2mtTDZPiLMWoMSCd9nEiK0BWI/qr9RODtlto9cEpfbDKR 6PFxxER6Ki3bZCNuu9CC8e+/fxWOmNNxhJ4opU0VBDUo2tOSNuJVA/rAfMzsVOoG6 FpuSqTl/0pgRVGEUHA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([88.130.49.45]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M2wL0-1soiJ30VZM-00AFrq for ; Sat, 21 Sep 2024 16:32:17 +0200 X-Provags-ID: V03:K1:6XgXqByIXHjwPClLi2hrmgRgNQk+HjDztTvSYu9quDxyTI/1xIJ LIdypnlBUkdDLEzaX4OBPrSQSfgxe+66OD/FJ24FyyROj1GuZEZp9aU3Ho+MjeSktBQEGYv HCAU245o+rppy2fV+yWU318yehRfpz5W9dUyhshgclQF1aC/pw38yKNieBsjlriPdgicbui csLxZaxb4FpRieI/4UkXw== UI-OutboundReport: notjunk:1;M01:P0:M86nkUN7FAk=;Qq8oK3KC/enauIF9f4VIsv/yzLP JESw/bXTVt/7iyAsK2DmVi1P9PvPY7BzARScraqirSZ+jonf4RStF1CuRMZ/bZm8eM+f2q+Ai RBhPEZuT06ljJwYfdxK6Br1DYdnKNdRK9xWD/cT/LN5UU3T7JUyxPT6JdeLWGfS9PDYKBWW79 Sdj0uMdZyhiJ4mmB9O4ze06k4424WwmfXcVjDR9HOf4+sO5/rWT79rvDq3PQSVZRwY55vJO6R OMGdglHbgWuo5SJxUMs+S/6PYZA/mvcSN5oRlRCMDXhuc+8r58uJrSgQ6x8kHqUcwW+m6idEP JeRKSZ0gLw867/Voh+conNSpkY5F43d8UmzpIfyVsTAEVmabZ9t4YqALcOIpejT4uDoMMIT9c QTo5G9mF9jmn7LSeTpAcSXgVLNCaxH09thLn0RxEQyvd39opU4ty9t6lV3F5+IL7HoIlkWebQ oenIVyzgT2suQjldPEYSrvrREHCSxt1oqhlppwrMywbsBNx/LTxfjeWT6EYeDbcF6P4XK5irz Go2Mybsu3Pfol9aDM4O0WznAGRuVO0tLuBEYV/piRkFkz8vVe3cVrP+Tt3nWWVyes6LdJJCAS ApLadvIzb99Wom5z6n5xFm/vmKcia1/GxBCsVGqEDCyQJRbyNzSQUCJiuLmCqXXt2RL5KKdRE m/EFOxEAhmGCJNxo2lqPQ/Y776DHDwdipb+DVqomDoSoTA1BFqmTWqFu6nrBlyLEkzRC6XYMe rxfcP9Jq0f4r6ctCuZohJRmqb67g5nlcRzPl2xQAP9RT74j+E/wFSrVPqkBuPV+aP6nqWiXe Received-SPF: pass client-ip=212.227.15.19; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292194 Archived-At: --=-=-= Content-Type: text/plain 0. emacs -Q 1. C-u M-x sql-product-interactive RET Now the minbuffer displays the following: SQL product: ansi so it you want to change the product, e.g. to postgres, you first have to delete "ansi". Likewise, `M-x sql-set-product RET' produces the same minbuffer display, requiring deletion to change the product. The reason "ansi" is displayed after the prompt is that the definition of sql-read-product uses the same non-nil value of the deprecated argument INITIAL-INPUT as is used for the argument DEF. The attached patch makes INITIAL-INPUT nil, thus using only DEF, and also wraps the prompt argument of sql-read-product in format-prompt, so the default value is shown as part of the prompt and changing it does not require deletion. The patch also adjusts the two callers of sql-read-product accordingly. In GNU Emacs 31.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) of 2024-09-12 built on strobelfssd Repository revision: 31e8500b061b6963708e66468fc89db1006226d7 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101013 System Description: Linux From Scratch r12.2-5-systemd Configured using: 'configure -C 'CFLAGS=-Og -g3'' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: sql-read-product patch Content-Transfer-Encoding: quoted-printable diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 5273ba2bee1..a0b350ce54f 100644 =2D-- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -2666,11 +2666,11 @@ sql-read-product "Read a valid SQL product." (let ((init (or (and initial (symbol-name initial)) "ansi"))) (intern (completing-read - prompt + (format-prompt prompt init) (mapcar (lambda (info) (symbol-name (car info))) sql-product-alist) nil 'require-match - init 'sql-product-history init)))) + nil 'sql-product-history init)))) (defun sql-add-product (product display &rest plist) "Add support for a database product in `sql-mode'. @@ -2912,7 +2912,7 @@ sql-highlight-product (defun sql-set-product (product) "Set `sql-product' to PRODUCT and enable appropriate highlighting." (interactive - (list (sql-read-product "SQL product: "))) + (list (sql-read-product "SQL product"))) (if (stringp product) (setq product (intern product))) (when (not (assoc product sql-product-alist)) (user-error "SQL product %s is not supported; treated as ANSI" produc= t) @@ -4546,7 +4546,7 @@ sql-product-interactive (setq product (cond ((=3D (prefix-numeric-value product) 4) ; C-u, prompt for produc= t - (sql-read-product "SQL product: " sql-product)) + (sql-read-product "SQL product" sql-product)) ((assoc product sql-product-alist) ; Product specified product) (t sql-product))) ; Default to sql-product --=-=-=--