From: Miles Bader Date: Mon, 7 Aug 2000 14:52:52 +0000 (+0000) Subject: (sql-magic-go): Use comint-bol instead of explicitly matching X-Git-Tag: emacs-pretest-21.0.90~2451 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3035b1565107e2277f363ed72536c8cffe7b4493;p=emacs.git (sql-magic-go): Use comint-bol instead of explicitly matching comint-prompt-regexp. (sql-copy-column): Use comint-line-beginning-position instead of explicitly matching comint-prompt-regexp. --- diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 500dd5267df..8cfd0278f3c 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -664,8 +664,8 @@ can be changed by some entry functions to provide more hilighting.") (self-insert-command (prefix-numeric-value arg)) (if (and (equal sql-electric-stuff 'go) (save-excursion - (beginning-of-line) - (looking-at (concat sql-prompt-regexp "go\\b")))) + (comint-bol nil) + (looking-at "go\\b"))) (comint-send-input))) (defun sql-magic-semicolon (arg) @@ -885,21 +885,21 @@ Inserts SELECT or commas if appropriate." (progn (forward-char 1) (backward-sexp 1) (point)) (progn (forward-sexp 1) (point)))) (goto-char (point-max)) - (cond - ;; if empty command line, insert SELECT - ((save-excursion (beginning-of-line) - (looking-at (concat comint-prompt-regexp "$"))) - (insert "SELECT ")) - ;; else if appending to INTO .* (, SELECT or ORDER BY, insert a comma - ((save-excursion - (re-search-backward "\\b\\(\\(into\\s-+\\S-+\\s-+(\\)\\|select\\|order by\\) .+" - (save-excursion (beginning-of-line) (point)) t)) - (insert ", ")) - ;; else insert a space - (t - (if (eq (preceding-char) ? ) - nil - (insert " ")))) + (let ((bol (comint-line-beginning-position))) + (cond + ;; if empty command line, insert SELECT + ((= bol (point)) + (insert "SELECT ")) + ;; else if appending to INTO .* (, SELECT or ORDER BY, insert a comma + ((save-excursion + (re-search-backward "\\b\\(\\(into\\s-+\\S-+\\s-+(\\)\\|select\\|order by\\) .+" + bol t)) + (insert ", ")) + ;; else insert a space + (t + (if (eq (preceding-char) ? ) + nil + (insert " "))))) ;; in any case, insert the column (insert column) (message "%s" column))))