From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 73412@debbugs.gnu.org
Subject: bug#73412: 31.0.50; Improve sql-read-product
Date: Sat, 21 Sep 2024 16:32:16 +0200 [thread overview]
Message-ID: <874j69nklr.fsf@gmx.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sql-read-product patch --]
[-- Type: text/x-patch, Size: 1622 bytes --]
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 5273ba2bee1..a0b350ce54f 100644
--- 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" product)
@@ -4546,7 +4546,7 @@ sql-product-interactive
(setq product
(cond
((= (prefix-numeric-value product) 4) ; C-u, prompt for product
- (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
next reply other threads:[~2024-09-21 14:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-21 14:32 Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-09-21 15:21 ` bug#73412: 31.0.50; Improve sql-read-product Eli Zaretskii
2024-09-21 20:29 ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-21 23:51 ` Stefan Kangas
2024-09-22 4:45 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874j69nklr.fsf@gmx.net \
--to=bug-gnu-emacs@gnu.org \
--cc=73412@debbugs.gnu.org \
--cc=stephen.berman@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.