From: Sam Steingold Date: Mon, 8 Sep 2014 12:27:19 +0000 (-0400) Subject: (sql-send-line-and-next): New command, bound to C-c C-n. X-Git-Tag: emacs-25.0.90~2635^2~679^2~330 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=11119fe02a5340a0da502106b0d6074384202451;p=emacs.git (sql-send-line-and-next): New command, bound to C-c C-n. * lisp/progmodes/sql.el (sql-send-line-and-next): New command, bound to C-c C-n. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 90f91d14afe..5529a252e27 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-09-08 Sam Steingold + + * progmodes/sql.el (sql-send-line-and-next): New command, + bound to C-c C-n. + 2014-09-08 Glenn Morris * calendar/calendar.el (calendar-basic-setup): diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 13d4178116e..2d3e048ebd1 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -212,11 +212,11 @@ ;; Michael Mauger -- improved product support ;; Drew Adams -- Emacs 20 support ;; Harald Maier -- sql-send-string -;; Stefan Monnier -- font-lock corrections; +;; Stefan Monnier -- font-lock corrections; ;; code polish ;; Paul Sleigh -- MySQL keyword enhancement ;; Andrew Schein -- sql-port bug -;; Ian Bjorhovde -- db2 escape newlines +;; Ian Bjorhovde -- db2 escape newlines ;; incorrectly enabled by default ;; Roman Scherer -- Connection documentation ;; Mark Wilkinson -- file-local variables ignored @@ -1221,6 +1221,7 @@ Based on `comint-mode-map'.") (define-key map (kbd "C-c C-r") 'sql-send-region) (define-key map (kbd "C-c C-s") 'sql-send-string) (define-key map (kbd "C-c C-b") 'sql-send-buffer) + (define-key map (kbd "C-c C-n") 'sql-send-line-and-next) (define-key map (kbd "C-c C-i") 'sql-product-interactive) (define-key map (kbd "C-c C-l a") 'sql-list-all) (define-key map (kbd "C-c C-l t") 'sql-list-table) @@ -3073,7 +3074,6 @@ variable `sql-buffer'. See `sql-help' on how to create such a buffer." (defun sql-make-alternate-buffer-name () "Return a string that can be used to rename a SQLi buffer. - This is used to set `sql-alternate-buffer-name' within `sql-interactive-mode'. @@ -3323,7 +3323,7 @@ to avoid deleting non-prompt output." (setq oline (replace-match "" nil nil oline) sql-output-newline-count (1- sql-output-newline-count) prompt-found t))) - + ;; If we've found all the expected prompts, stop looking (if (= sql-output-newline-count 0) (setq sql-output-newline-count nil @@ -3403,6 +3403,13 @@ to avoid deleting non-prompt output." (interactive) (sql-send-region (point-min) (point-max))) +(defun sql-send-line-and-next () + "Send the current line to the SQL process and go to the next line." + (interactive) + (sql-send-region (line-beginning-position 1) (line-beginning-position 2)) + (beginning-of-line 2) + (while (forward-comment 1))) ; skip all comments and whitespace + (defun sql-send-magic-terminator (buf str terminator) "Send TERMINATOR to buffer BUF if its not present in STR." (let (comint-input-sender-no-newline pat term) @@ -3589,7 +3596,7 @@ buffer is popped into a view window." (apply c sqlbuf outbuf enhanced arg nil)) (t (error "Unknown sql-execute item %s" c)))) (if (consp command) command (cons command nil))) - + (setq outbuf (get-buffer outbuf)) (if (zerop (buffer-size outbuf)) (kill-buffer outbuf)