aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael R. Mauger2015-03-14 23:05:28 -0400
committerMichael R. Mauger2015-03-14 23:05:28 -0400
commit84a6685660fd7585d9b7a5bb30dda7cf41c3ea84 (patch)
tree1e999a802bdb55ad924f72d319bb8efb49270da8
parent3bf369928e44fd83c27ef436b05d9cd2b4abbfba (diff)
downloademacs-84a6685660fd7585d9b7a5bb30dda7cf41c3ea84.tar.gz
emacs-84a6685660fd7585d9b7a5bb30dda7cf41c3ea84.zip
2015-03-14 Michael R. Mauger <michael@mauger.com>
* progmodes/sql.el: Version 3.5 (sql-starts-with-prompt-re, sql-ends-with-prompt-re): Match password prompts. (sql-interactive-remove-continuation-prompt): Fixed regression. (Bug#6686)
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/progmodes/sql.el45
2 files changed, 35 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8da573ed2f7..e0891e1947c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12015-03-14 Michael R. Mauger <michael@mauger.com>
2
3 * progmodes/sql.el: Version 3.5
4 (sql-starts-with-prompt-re, sql-ends-with-prompt-re): Match password prompts.
5 (sql-interactive-remove-continuation-prompt): Fixed regression. (Bug#6686)
6
12015-03-14 Daniel Colascione <dancol@dancol.org> 72015-03-14 Daniel Colascione <dancol@dancol.org>
2 8
3 * startup.el (command-line): Process "--no-x-resources". 9 * startup.el (command-line): Process "--no-x-resources".
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 2ed3a745bb0..3800cfb6b15 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Alex Schroeder <alex@gnu.org> 5;; Author: Alex Schroeder <alex@gnu.org>
6;; Maintainer: Michael Mauger <michael@mauger.com> 6;; Maintainer: Michael Mauger <michael@mauger.com>
7;; Version: 3.4 7;; Version: 3.5
8;; Keywords: comm languages processes 8;; Keywords: comm languages processes
9;; URL: http://savannah.gnu.org/projects/emacs/ 9;; URL: http://savannah.gnu.org/projects/emacs/
10 10
@@ -3296,13 +3296,13 @@ Allows the suppression of continuation prompts.")
3296(defun sql-starts-with-prompt-re () 3296(defun sql-starts-with-prompt-re ()
3297 "Anchor the prompt expression at the beginning of the output line. 3297 "Anchor the prompt expression at the beginning of the output line.
3298Remove the start of line regexp." 3298Remove the start of line regexp."
3299 (replace-regexp-in-string "\\^" "\\\\`" comint-prompt-regexp)) 3299 (concat "\\`" comint-prompt-regexp))
3300 3300
3301(defun sql-ends-with-prompt-re () 3301(defun sql-ends-with-prompt-re ()
3302 "Anchor the prompt expression at the end of the output line. 3302 "Anchor the prompt expression at the end of the output line.
3303Remove the start of line regexp from the prompt expression since 3303Match a SQL prompt or a password prompt."
3304it may not follow newline characters in the output line." 3304 (concat "\\(?:\\(?:" sql-prompt-regexp "\\)\\|"
3305 (concat (replace-regexp-in-string "\\^" "" sql-prompt-regexp) "\\'")) 3305 "\\(?:" comint-password-prompt-regexp "\\)\\)\\'"))
3306 3306
3307(defun sql-interactive-remove-continuation-prompt (oline) 3307(defun sql-interactive-remove-continuation-prompt (oline)
3308 "Strip out continuation prompts out of the OLINE. 3308 "Strip out continuation prompts out of the OLINE.
@@ -3321,7 +3321,17 @@ to the next chunk to properly match the broken-up prompt.
3321If the filter gets confused, it should reset and stop filtering 3321If the filter gets confused, it should reset and stop filtering
3322to avoid deleting non-prompt output." 3322to avoid deleting non-prompt output."
3323 3323
3324 (when comint-prompt-regexp 3324 ;; continue gathering lines of text iff
3325 ;; + we know what a prompt looks like, and
3326 ;; + there is held text, or
3327 ;; + there are continuation prompt yet to come, or
3328 ;; + not just a prompt string
3329 (when (and comint-prompt-regexp
3330 (or (> (length (or sql-preoutput-hold "")) 0)
3331 (> (or sql-output-newline-count 0) 0)
3332 (not (or (string-match sql-prompt-regexp oline)
3333 (string-match sql-prompt-cont-regexp oline)))))
3334
3325 (save-match-data 3335 (save-match-data
3326 (let (prompt-found last-nl) 3336 (let (prompt-found last-nl)
3327 3337
@@ -3357,16 +3367,19 @@ to avoid deleting non-prompt output."
3357 sql-preoutput-hold "")) 3367 sql-preoutput-hold ""))
3358 3368
3359 ;; Break up output by physical lines if we haven't hit the final prompt 3369 ;; Break up output by physical lines if we haven't hit the final prompt
3360 (unless (and (not (string= oline "")) 3370 (let ((end-re (sql-ends-with-prompt-re)))
3361 (string-match (sql-ends-with-prompt-re) oline) 3371 (unless (and (not (string= oline ""))
3362 (>= (match-end 0) (length oline))) 3372 (string-match end-re oline)
3363 (setq last-nl 0) 3373 (>= (match-end 0) (length oline)))
3364 (while (string-match "\n" oline last-nl) 3374 ;; Find everything upto the last nl
3365 (setq last-nl (match-end 0))) 3375 (setq last-nl 0)
3366 (setq sql-preoutput-hold (concat (substring oline last-nl) 3376 (while (string-match "\n" oline last-nl)
3367 sql-preoutput-hold) 3377 (setq last-nl (match-end 0)))
3368 oline (substring oline 0 last-nl)))))) 3378 ;; Hold after the last nl, return upto last nl
3369 oline) 3379 (setq sql-preoutput-hold (concat (substring oline last-nl)
3380 sql-preoutput-hold)
3381 oline (substring oline 0 last-nl)))))))
3382 oline)
3370 3383
3371;;; Sending the region to the SQLi buffer. 3384;;; Sending the region to the SQLi buffer.
3372 3385