Is there a way to fix
command
in a wrapper function?
Sure, you just need to read the start
and end
and then pass them along with a hard-coded command
.
(defun my-sql-send-region-via-FOO (start end)
"Send a region to the SQL process via shell command FOO."
(interactive "r")
(my-sql-send-region-via-shell-command "FOO" start end))
You could also make start
and end
optional, and have the main function figure them out when they're not passed. I'll leave that as an exercise for the reader...
how can I automatically switch the focus to the
sql-interactive-mode
buffer after the command is issued?
It looks like sql-send-string
supports that directly; try adding (sql-pop-to-buffer-after-send-region t)
to the outermost let
bindings.