forked from purcell/emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-sql.el
35 lines (29 loc) · 1.13 KB
/
init-sql.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(require-package 'sql-indent)
(after-load 'sql
(require 'sql-indent))
(defun sanityinc/pop-to-sqli-buffer ()
"Switch to the corresponding sqli buffer."
(interactive)
(if sql-buffer
(progn
(pop-to-buffer sql-buffer)
(goto-char (point-max)))
(sql-set-sqli-buffer)
(when sql-buffer
(sanityinc/pop-to-sqli-buffer))))
(after-load 'sql
(define-key sql-mode-map (kbd "C-c C-z") 'sanityinc/pop-to-sqli-buffer)
(add-hook 'sql-interactive-mode-hook 'sanityinc/never-indent)
(when (package-installed-p 'dash-at-point)
(defun sanityinc/maybe-set-dash-db-docset ()
(when (eq sql-product 'postgres)
(setq dash-at-point-docset "psql")))
(add-hook 'sql-mode-hook 'sanityinc/maybe-set-dash-db-docset)
(add-hook 'sql-interactive-mode-hook 'sanityinc/maybe-set-dash-db-docset)
(defadvice sql-set-product (after set-dash-docset activate)
(sanityinc/maybe-set-dash-db-docset))))
(setq-default sql-input-ring-file-name
(expand-file-name ".sqli_history" user-emacs-directory))
(after-load 'page-break-lines
(push 'sql-mode page-break-lines-modes))
(provide 'init-sql)