diff options
| author | Michael R. Mauger | 2019-02-18 21:51:09 -0500 |
|---|---|---|
| committer | Michael R. Mauger | 2019-02-18 21:52:36 -0500 |
| commit | ed1e805af7d4892e7354e8c9e2246d5017d4ff52 (patch) | |
| tree | c8db63cd74ee3df52855af1ce5cc568cd0698544 /lisp/progmodes/sql.el | |
| parent | e66d5a1c4528681ba6b3465faaa197a5701763cb (diff) | |
| download | emacs-ed1e805af7d4892e7354e8c9e2246d5017d4ff52.tar.gz emacs-ed1e805af7d4892e7354e8c9e2246d5017d4ff52.zip | |
* lisp/progmodes/sql.el defensive programming
(sql-statement-regexp): if 'ansi' dialect is not defined, use "select"
(sql-interactive-mode): establish process sentinel iff there is a
process. Default values for :prompt-regexp and :prompt-length.
(sql-product-interactive): only check process status iff there is a
process.
Diffstat (limited to 'lisp/progmodes/sql.el')
| -rw-r--r-- | lisp/progmodes/sql.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 6ad221295ca..2df62585a0d 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el | |||
| @@ -2929,7 +2929,7 @@ displayed." | |||
| 2929 | ;;; Motion Functions | 2929 | ;;; Motion Functions |
| 2930 | 2930 | ||
| 2931 | (defun sql-statement-regexp (prod) | 2931 | (defun sql-statement-regexp (prod) |
| 2932 | (let* ((ansi-stmt (sql-get-product-feature 'ansi :statement)) | 2932 | (let* ((ansi-stmt (or (sql-get-product-feature 'ansi :statement) "select")) |
| 2933 | (prod-stmt (sql-get-product-feature prod :statement))) | 2933 | (prod-stmt (sql-get-product-feature prod :statement))) |
| 2934 | (concat "^\\<" | 2934 | (concat "^\\<" |
| 2935 | (if prod-stmt | 2935 | (if prod-stmt |
| @@ -4193,7 +4193,8 @@ you entered, right above the output it created. | |||
| 4193 | (setq local-abbrev-table sql-mode-abbrev-table) | 4193 | (setq local-abbrev-table sql-mode-abbrev-table) |
| 4194 | (setq abbrev-all-caps 1) | 4194 | (setq abbrev-all-caps 1) |
| 4195 | ;; Exiting the process will call sql-stop. | 4195 | ;; Exiting the process will call sql-stop. |
| 4196 | (set-process-sentinel (get-buffer-process (current-buffer)) 'sql-stop) | 4196 | (let ((proc (get-buffer-process (current-buffer)))) |
| 4197 | (when proc (set-process-sentinel proc 'sql-stop))) | ||
| 4197 | ;; Save the connection and login params | 4198 | ;; Save the connection and login params |
| 4198 | (set (make-local-variable 'sql-user) sql-user) | 4199 | (set (make-local-variable 'sql-user) sql-user) |
| 4199 | (set (make-local-variable 'sql-database) sql-database) | 4200 | (set (make-local-variable 'sql-database) sql-database) |
| @@ -4211,7 +4212,7 @@ you entered, right above the output it created. | |||
| 4211 | (sql-make-alternate-buffer-name)) | 4212 | (sql-make-alternate-buffer-name)) |
| 4212 | ;; User stuff. Initialize before the hook. | 4213 | ;; User stuff. Initialize before the hook. |
| 4213 | (set (make-local-variable 'sql-prompt-regexp) | 4214 | (set (make-local-variable 'sql-prompt-regexp) |
| 4214 | (sql-get-product-feature sql-product :prompt-regexp)) | 4215 | (or (sql-get-product-feature sql-product :prompt-regexp) "^")) |
| 4215 | (set (make-local-variable 'sql-prompt-length) | 4216 | (set (make-local-variable 'sql-prompt-length) |
| 4216 | (sql-get-product-feature sql-product :prompt-length)) | 4217 | (sql-get-product-feature sql-product :prompt-length)) |
| 4217 | (set (make-local-variable 'sql-prompt-cont-regexp) | 4218 | (set (make-local-variable 'sql-prompt-cont-regexp) |
| @@ -4230,7 +4231,7 @@ you entered, right above the output it created. | |||
| 4230 | (concat "\\(" sql-prompt-regexp | 4231 | (concat "\\(" sql-prompt-regexp |
| 4231 | "\\|" sql-prompt-cont-regexp "\\)") | 4232 | "\\|" sql-prompt-cont-regexp "\\)") |
| 4232 | sql-prompt-regexp)) | 4233 | sql-prompt-regexp)) |
| 4233 | (setq left-margin sql-prompt-length) | 4234 | (setq left-margin (or sql-prompt-length 0)) |
| 4234 | ;; Install input sender | 4235 | ;; Install input sender |
| 4235 | (set (make-local-variable 'comint-input-sender) 'sql-input-sender) | 4236 | (set (make-local-variable 'comint-input-sender) 'sql-input-sender) |
| 4236 | ;; People wanting a different history file for each | 4237 | ;; People wanting a different history file for each |
| @@ -4522,7 +4523,8 @@ the call to \\[sql-product-interactive] with | |||
| 4522 | (let ((proc (get-buffer-process new-sqli-buffer)) | 4523 | (let ((proc (get-buffer-process new-sqli-buffer)) |
| 4523 | (secs sql-login-delay) | 4524 | (secs sql-login-delay) |
| 4524 | (step 0.3)) | 4525 | (step 0.3)) |
| 4525 | (while (and (memq (process-status proc) '(open run)) | 4526 | (while (and proc |
| 4527 | (memq (process-status proc) '(open run)) | ||
| 4526 | (or (accept-process-output proc step) | 4528 | (or (accept-process-output proc step) |
| 4527 | (<= 0.0 (setq secs (- secs step)))) | 4529 | (<= 0.0 (setq secs (- secs step)))) |
| 4528 | (progn (goto-char (point-max)) | 4530 | (progn (goto-char (point-max)) |