branch: externals/drepl
commit e9c64170c47df1fb582eac9fd896bd6e6e2b3512
Author: Augusto Stoffel <[email protected]>
Commit: Augusto Stoffel <[email protected]>

    Configure indentation in usql buffers, so that completion works
---
 drepl-usql.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drepl-usql.el b/drepl-usql.el
index 0461f509b0..b251e5b7a0 100644
--- a/drepl-usql.el
+++ b/drepl-usql.el
@@ -71,9 +71,16 @@
            (propertize "M-x drepl-usql-build" 'face 'help-key-binding))
     (user-error "%s not found" drepl-usql-program)))
 
+(defun drepl-usql--comint-indirect-setup ()
+  "Function to set up indentation in the comint indirect buffer."
+  ;; This at least ensures TAB completion works.
+  (setq-local indent-line-function #'ignore)
+  (when (fboundp 'sql-indent-enable) (sql-indent-enable)))
+
 (cl-defmethod drepl--init ((repl drepl-usql))
   (cl-call-next-method repl)
   (push '("5151" . comint-mime-osc-handler) ansi-osc-handlers)
+  (add-hook 'comint-indirect-setup-hook #'drepl-usql--comint-indirect-setup 
nil t)
   (drepl--adapt-comint-to-mode ".sql"))
 
 (provide 'drepl-usql)

Reply via email to