diff options
author | Michael R. Mauger <michael@mauger.com> | 2021-10-19 00:18:17 -0400 |
---|---|---|
committer | Michael R. Mauger <michael@mauger.com> | 2021-10-19 00:18:17 -0400 |
commit | 0be85f22176730b951e9ec18e298c9e1e039d8fb (patch) | |
tree | b619c071e828a6edb5f14706fa9484d8f1ddc6db /lisp/progmodes/sql.el | |
parent | dcb815ac8a5d52a269fbb45b78235b81c6aa11b5 (diff) | |
download | emacs-0be85f22176730b951e9ec18e298c9e1e039d8fb.tar.gz emacs-0be85f22176730b951e9ec18e298c9e1e039d8fb.tar.bz2 emacs-0be85f22176730b951e9ec18e298c9e1e039d8fb.zip |
SQL mode supports sending passwords in process
Diffstat (limited to 'lisp/progmodes/sql.el')
-rw-r--r-- | lisp/progmodes/sql.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 0789c95e87a..f5888a0ce7a 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -4659,6 +4659,14 @@ the call to \\[sql-product-interactive] with (get-buffer new-sqli-buffer))))) (user-error "No default SQL product defined: set `sql-product'"))) +(defun sql-comint-automatic-password (_) + "Intercept password prompts when we know the password. +This must also do the job of detecting password prompts." + (when (and + sql-password + (not (string= "" sql-password))) + sql-password)) + (defun sql-comint (product params &optional buf-name) "Set up a comint buffer to run the SQL processor. @@ -4683,6 +4691,13 @@ buffer. If nil, a name is chosen for it." (setq buf-name (sql-generate-unique-sqli-buffer-name product nil))) (set-text-properties 0 (length buf-name) nil buf-name) + ;; Create the buffer first, because we want to set it up before + ;; comint starts to run. + (set-buffer (get-buffer-create buf-name)) + ;; Set up the automatic population of passwords, if supported. + (when (sql-get-product-feature product :password-in-comint) + (setq comint-password-function #'sql-comint-automatic-password)) + ;; Start the command interpreter in the buffer ;; PROC-NAME is BUF-NAME without enclosing asterisks (let ((proc-name (replace-regexp-in-string "\\`[*]\\(.*\\)[*]\\'" "\\1" buf-name))) |