GNU bug report logs -
#73499
31.0.50; sql-interactive-mode problem with package caps-lock-mode
Previous Next
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
Message #8 received at 73499 <at> debbugs.gnu.org (full text, mbox):
> Date: Thu, 26 Sep 2024 14:44:12 +0200
> From: Stephen Berman via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> 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):
>
>
> 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:
Stefan, Andrea, Stefan: any opinions on which way is better?
Thanks.
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.