On Sat, 05 Oct 2024 13:22:02 +0300 Eli Zaretskii wrote: >> From: Andrea Corallo >> Cc: Eli Zaretskii , Stephen Berman , >> Stefan Kangas , 73499@debbugs.gnu.org >> Date: Tue, 01 Oct 2024 14:44:13 -0400 >> >> Stefan Monnier writes: >> >> >> Stefan, Andrea, Stefan: any opinions on which way is better? >> > >> > My vote is clearly for `post-self-insert-hook`. >> >> Same > > OK, so Stephen, please do it that way, and thanks. Sure; however, my testing of the patch before posting it was inadequate, and the patch needs to be amended. As is it now, if you customize sql-electric-stuff to use sql-magic-go and then type "go" at the prompt in a comint-derived mode other than sql-interactive-mode, that wrongly calls comint-send-input. E.g. in shell-mode, this results in the shell output "bash: go: command not found". And in an arbitary buffer not derived from comint-mode, typing "go" at BOB causes a ding and shows the message "Current buffer has no process". These problems are because the patch adds sql-magic-go to post-self-insert-hook globally; since this is done when customizing sql-electric-stuff, the current buffer need not (and probably won't) be in sql-interactive-mode, so the hook can't be added locally. AFAICS the simplest fix is to check (eq major-mode 'sql-interactive-mode) in sql-magic-go, as in the attached patch. If there's no objection to this, then I'll go ahead and commit the amended patch to master. Steve Berman