GNU bug report logs - #73499
31.0.50; sql-interactive-mode problem with package caps-lock-mode

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Thu, 26 Sep 2024 12:45:01 UTC

Severity: normal

Found in version 31.0.50

Done: Stephen Berman <stephen.berman <at> gmx.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stephen Berman <stephen.berman <at> gmx.net>
To: 73499 <at> debbugs.gnu.org
Subject: bug#73499: 31.0.50; sql-interactive-mode problem with package caps-lock-mode
Date: Thu, 26 Sep 2024 14:44:12 +0200
[Message part 1 (text/plain, inline)]
0. Install the GNU ELPA package caps-lock.
1. emacs -Q
2. M-x package-initialize
3. Start an SQL inferior process, e.g. with `M-x sql-sqlite RET test RET'.
4. In the *SQL: SQLite* buffer type `M-x caps-lock-mode' and at sqlite>
   prompt type "select * from".
=> The typed text appears as this: "SELECT * FRoM", with a lowercase "o"
   instead of an uppercase "O".

This is because sql-interactive-mode-map binds both "o" and "O" to the
command `sql-magic-go', but caps-lock-mode changes case only if the last
key event either invoked `self-insert-command' or
`isearch-printing-char' or if the command it invoked remaps
self-insert-command, and since neither is the case here, no case change
occurs.  (You can of course enter "O" by typing S-o, but caps-lock-mode
is supposed to obviate the need to do that.)  This problem also happens
with PostgreSQL and presumably other SQL interpreters supported by
sql.el (but I have only tested SQLite and PostgreSQL).

I have found two ways to fix this problem.  One is simply to add
`sql-magic-go' to the list `caps-lock-commands'.  In caps-lock.el this
is a defvar with the value '(self-insert-command isearch-printing-char).
Instead of just changing this value in the source code, I think it would
be better to make the variable a defcustom, since many packages bind
letter keys to commands other than `self-insert-command' but may
nevertheless want to change the case of these letters when
caps-lock-mode is enabled.  So it would be up to the user to add
`sql-magic-go' to the value.  Here's a patch that allows this (I don't
have a local clone of the GNU ELPA repo, so it's just a plain diff):

[Message part 2 (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
The alternative fix is to change the implemention of `sql-magic-go' so
it doesn't interfere with caps-lock-mode; this would absolve the user
from the responsability of customizing which commands trigger case
change, but requires more invasive changes to sql.el (at least I haven't
come up with a simpler change), specifically, (i) removing the bindings
of "o" and "O", (ii) making `sql-magic-go' a function instead of a
command, which checks if the last keyboard input was either of these
letters and if so, does what `sql-magic-go' is supposed to do, and (iii)
adding `sql-magic-go' to `post-self-insert-hook' if `sql-electric-stuff'
is customized to give the string "go" special handling.  Here's the
patch:

[Message part 4 (text/x-patch, attachment)]
[Message part 5 (text/plain, inline)]

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.2) of 2024-09-22 built on strobelfssd
Repository revision: 3fb966dc6392e1908304a1b6fe481da9f670cfbb
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' PKG_CONFIG_PATH=/opt/qt6/lib/pkgconfig'

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

This bug report was last modified 272 days ago.

Previous Next


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