forked from magnars/.emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup-autopair.el
42 lines (31 loc) · 1.11 KB
/
setup-autopair.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
36
37
38
39
40
41
42
;; Autopair () {} <> "" '' etc
(require 'autopair)
(autopair-global-mode)
(setq autopair-blink nil)
(defun autopair-dont ()
(interactive)
(setq autopair-dont-activate t))
(add-hook 'emacs-lisp-mode-hook 'autopair-dont)
(add-hook 'lisp-interaction-mode 'autopair-dont)
(require 'setup-code-modes)
(install-hooks lisp-modes-hook 'autopair-dont)
(set-default 'autopair-dont-activate #'(lambda ()
(eq major-mode 'term-mode)))
(setq autopair-autowrap t)
(add-hook 'c++-mode-hook
#'(lambda ()
(push ?{
(getf autopair-dont-pair :comment))))
(when nil
(add-hook 'c++-mode-hook
#'(lambda ()
(push '(?< . ?>)
(getf autopair-extra-pairs :code))))
)
(defun autopair-paren () (push '(?\( . ?\)) (getf autopair-extra-pairs :code)))
(add-hook 'latex-mode-hook
#'(lambda ()
(set (make-local-variable 'autopair-handle-action-fns)
(list #'autopair-default-handle-action
#'autopair-latex-mode-paired-delimiter-action))))
(provide 'setup-autopair)