Function: sql-send-magic-terminator

sql-send-magic-terminator is a byte-compiled function defined in sql.el.gz.

Signature

(sql-send-magic-terminator BUF STR TERMINATOR)

Documentation

Send TERMINATOR to buffer BUF if its not present in STR.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/sql.el.gz
  (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)
    ;; If flag is merely on(t), get product-specific terminator
    (if (eq terminator t)
	(setq terminator (sql-get-product-feature sql-product :terminator)))

    ;; If there is no terminator specified, use default ";"
    (unless terminator
      (setq terminator ";"))

    ;; Parse the setting into the pattern and the terminator string
    (cond ((stringp terminator)
	   (setq pat (regexp-quote terminator)
		 term terminator))
	  ((consp terminator)
	   (setq pat (car terminator)
		 term (cdr terminator)))
	  (t
	   nil))

    ;; Check to see if the pattern is present in the str already sent
    (unless (and pat term
		 (string-match-p (concat pat "\\'") str))
      (sql-input-sender (get-buffer-process buf) term))))