forked from redguardtoo/emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-lisp.el
75 lines (59 loc) · 2.58 KB
/
init-lisp.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
;; Paredit
;; ----------------------------------------------------------------------------
(setq-default initial-scratch-message
(if (executable-find "fortune")
(format
";; %s\n\n"
(replace-regexp-in-string
"\n" "\n;; " ; comment each line
(replace-regexp-in-string
"\n$" "" ; remove trailing linebreak
(shell-command-to-string "fortune"))))
(concat ";; Happy hacking "
(or user-login-name "")
" - Emacs loves you!\n\n")))
;; racket
(add-to-list 'auto-mode-alist '("\\.rkt\\'" . lisp-mode))
;; {{ scheme setup
(setq scheme-program-name "guile")
(eval-after-load 'scheme-mode
'(progn
(require 'quack)))
;; }}
;; A quick way to jump to the definition of a function given its key binding
(global-set-key (kbd "C-h K") 'find-function-on-key)
(eval-after-load 'paredit
'(progn
(diminish 'paredit-mode " Par")))
(defvar paredit-minibuffer-commands '(eval-expression
pp-eval-expression
eval-expression-with-eldoc
ibuffer-do-eval
ibuffer-do-view-and-eval)
"Interactive commands for which paredit should be enabled in the minibuffer.")
(defun conditionally-paredit-mode (flag)
"Enable paredit during lisp-related minibuffer commands."
(if (memq this-command paredit-minibuffer-commands)
(paredit-mode flag)))
;; ----------------------------------------------------------------------------
;; Highlight current sexp
;; ----------------------------------------------------------------------------
;; Prevent flickery behaviour due to hl-sexp-mode unhighlighting before each command
(eval-after-load 'hl-sexp
'(defadvice hl-sexp-mode (after unflicker (turn-on) activate)
(when turn-on
(remove-hook 'pre-command-hook #'hl-sexp-unhighlight))))
;; ----------------------------------------------------------------------------
;; Enable desired features for all lisp modes
;; ----------------------------------------------------------------------------
(defun sanityinc/lisp-setup ()
"Enable features useful in any Lisp mode."
(enable-paredit-mode)
(rainbow-delimiters-mode t)
(turn-on-eldoc-mode))
(let* ((lispy-hooks '(lisp-mode-hook
inferior-lisp-mode-hook
lisp-interaction-mode-hook)))
(dolist (hook lispy-hooks)
(add-hook hook 'sanityinc/lisp-setup)))
(provide 'init-lisp)