-
Notifications
You must be signed in to change notification settings - Fork 0
/
.lisp-format
65 lines (60 loc) · 2.71 KB
/
.lisp-format
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
;;;; -*- emacs-lisp -*-
(mapc (lambda (dir) (add-to-list 'load-path dir))
(directory-files (concat (getenv "QUICK_LISP")
"/dists/quicklisp/software/") t "slime-v*"))
(defun verbose-require (package)
(unless (ignore-errors (require package))
(message "Failed to load the package '%S'." package)
(message "Ensure %s is installed locally, and then edit your" package)
(message "\"~/.lisp-formatrc\" file adding %s to your load path.\n" package)
(message " (add-to-list 'load-path </path/to/%s.el>)\n" package)
;; After printing the messages require again to trigger the error.
(require package)))
(verbose-require 'slime)
(verbose-require 'paredit)
(set-default 'indent-tabs-mode nil)
(pushnew 'untabify *lisp-format-fixers*)
(defun fix-trailing-parens (start end &optional _arg)
"Use `paredit-close-parenthesis' to fix trailing parens."
(interactive (if current-prefix-arg
(list (point-min) (point-max) current-prefix-arg)
(list (region-beginning) (region-end) nil)))
(let ((c (current-column)))
(save-excursion
(save-restriction
(narrow-to-region (point-min) end)
(goto-char start)
(while (re-search-forward "^ *)" nil t)
(forward-char -1)
(paredit-close-parenthesis))))
(move-to-column c)))
(pushnew 'fix-trailing-parens *lisp-format-fixers*)
;;; Syntax table extension for curry-compose-reader-macros
(modify-syntax-entry ?\[ "(]" lisp-mode-syntax-table)
(modify-syntax-entry ?\] ")[" lisp-mode-syntax-table)
(modify-syntax-entry ?\{ "(}" lisp-mode-syntax-table)
(modify-syntax-entry ?\} "){" lisp-mode-syntax-table)
(modify-syntax-entry ?\« "(»" lisp-mode-syntax-table)
(modify-syntax-entry ?\» ")«" lisp-mode-syntax-table)
;;; Specify indentation levels for specific functions.
(mapc (lambda (pair) (put (first pair) 'lisp-indent-function (second pair)))
'((make-instance 1)
(if-let 1)
(if-let* 1)
(when-let 1)
(when-let* 1)
(defroute 2)
(defixture 1)))
(defun define-feature-lisp-indent
(path state indent-point sexp-column normal-indent)
"Indentation function called by `lisp-indent-function' for define-feature."
;; (message "CALLED: %S"
;; (list 'define-feature-lisp-indent
;; path state indent-point sexp-column normal-indent))
(cond
((equalp path '(2)) 2) ; Doc string for enclosing define-feature.
((equalp path '(3)) 2) ; Extractor function definition.
((equalp path '(3 2)) 4) ; Doc string for extractor.
((equalp path '(4)) 2) ; Merge function definition.
(t nil))) ; Otherwise do the default.
(put 'define-feature 'lisp-indent-function 'define-feature-lisp-indent)