:type 'booleanp
:version "27.1")
-(defun sql-is-indent-available ()
- "Check if sql-indent module is available."
- (when (locate-library "sql-indent")
- (fboundp 'sqlind-minor-mode)))
-
(defun sql-indent-enable ()
"Enable `sqlind-minor-mode' if available and requested."
- (when (sql-is-indent-available)
+ (when (fboundp 'sqlind-minor-mode)
(sqlind-minor-mode (if sql-use-indent-support +1 -1))))
;; Secure Password wallet
(defvaralias 'sql-pop-to-buffer-after-send-region 'sql-display-sqli-buffer-function)
-(defcustom sql-display-sqli-buffer-function 'display-buffer
+(defcustom sql-display-sqli-buffer-function #'display-buffer
"Function to be called to display a SQLi buffer after `sql-send-*'.
When set to a function, it will be called to display the buffer.
;; Count how many newlines in the string
(setq sql-output-newline-count
- (apply #'+ (mapcar (lambda (ch)
- (if (eq ch ?\n) 1 0)) string)))
+ (apply #'+ (mapcar (lambda (ch) (if (eq ch ?\n) 1 0))
+ string)))
;; Send the string
(comint-simple-send proc string)))
;; Set syntax and font-face highlighting
;; Catch changes to sql-product and highlight accordingly
(sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591
- (add-hook 'hack-local-variables-hook 'sql-highlight-product t t))
+ (add-hook 'hack-local-variables-hook #'sql-highlight-product t t))
\f
(put 'sql-interactive-mode 'mode-class 'special)
(put 'sql-interactive-mode 'custom-mode-group 'SQL)
-
+;; FIXME: Why not use `define-derived-mode'?
(defun sql-interactive-mode ()
"Major mode to use a SQL interpreter interactively.
\(add-hook \\='sql-interactive-mode-hook
(function (lambda ()
- (setq comint-output-filter-functions \\='comint-truncate-buffer))))
+ (setq comint-output-filter-functions #\\='comint-truncate-buffer))))
Here is another example. It will always put point back to the statement
you entered, right above the output it created.
\(setq comint-output-filter-functions
(function (lambda (STR) (comint-show-output))))"
+ ;; FIXME: The doc above uses `setq' on `comint-output-filter-functions',
+ ;; whereas hooks should be manipulated with things like `add/remove-hook'.
(delay-mode-hooks (comint-mode))
;; Get the `sql-product' for this interactive session.
(setq abbrev-all-caps 1)
;; Exiting the process will call sql-stop.
(let ((proc (get-buffer-process (current-buffer))))
- (when proc (set-process-sentinel proc 'sql-stop)))
+ (when proc (set-process-sentinel proc #'sql-stop)))
;; Save the connection and login params
(set (make-local-variable 'sql-user) sql-user)
(set (make-local-variable 'sql-database) sql-database)
(make-local-variable 'sql-output-newline-count)
(make-local-variable 'sql-preoutput-hold)
(add-hook 'comint-preoutput-filter-functions
- 'sql-interactive-remove-continuation-prompt nil t)
+ #'sql-interactive-remove-continuation-prompt nil t)
(make-local-variable 'sql-input-ring-separator)
(make-local-variable 'sql-input-ring-file-name)
;; Run the mode hook (along with comint's hooks).
"Read a connection name."
(let ((completion-ignore-case t))
(completing-read prompt
- (mapcar (lambda (c) (car c))
- sql-connection-alist)
+ (mapcar #'car sql-connection-alist)
nil t initial 'sql-connection-history default)))
;;;###autoload
your might try undecided-dos as a coding system. If this doesn't help,
Try to set `comint-output-filter-functions' like this:
-\(setq comint-output-filter-functions (append comint-output-filter-functions
- \\='(comint-strip-ctrl-m)))
+\(add-hook 'comint-output-filter-functions #\\='comint-strip-ctrl-m 'append)
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
(interactive "P")