doomemacs/modules/module-elisp.el

123 lines
4.8 KiB
EmacsLisp
Raw Normal View History

2016-05-24 04:52:21 +08:00
;;; module-elisp --- all things lisp
2015-06-15 15:06:10 +08:00
(associate! emacs-lisp-mode :match "\\(/Cask\\|\\.\\(el\\|gz\\)\\)$")
(add-hook! emacs-lisp-mode '(turn-on-eldoc-mode flycheck-mode highlight-numbers-mode))
2015-06-15 15:06:10 +08:00
2016-05-21 07:08:02 +08:00
;; Real go-to-definition for elisp
2016-05-21 10:37:30 +08:00
(map! :map emacs-lisp-mode-map :m "gd" 'doom/elisp-find-function-at-pt)
2016-05-21 10:37:30 +08:00
(add-hook 'emacs-lisp-mode-hook 'doom/elisp-init)
(defun doom/elisp-init ()
(def-company-backend! emacs-lisp-mode (elisp yasnippet))
2016-05-21 10:37:30 +08:00
(def-repl! emacs-lisp-mode doom/elisp-inf-ielm)
(def-rotate! emacs-lisp-mode
:symbols (("t" "nil")
("let" "let*")
("when" "unless")
("append" "prepend")
("advice-add" "advice-remove")
("add-hook" "add-hook!" "remove-hook")))
2016-05-25 09:57:25 +08:00
(def-popup! "*ert*" :align below :size 20 :noselect t)
;; Don't affect lisp indentation (only `tab-width')
(setq editorconfig-indentation-alist
(delq (assq 'emacs-lisp-mode editorconfig-indentation-alist)
editorconfig-indentation-alist))
2016-05-21 10:37:30 +08:00
(remove-hook 'emacs-lisp-mode-hook 'doom/elisp-init))
2015-06-15 15:06:10 +08:00
2016-05-21 10:37:30 +08:00
(add-hook 'emacs-lisp-mode-hook 'doom/elisp-hook)
(defun doom/elisp-hook ()
(setq mode-name "Elisp") ; [pedantry intensifies]
2016-05-11 17:36:49 +08:00
(font-lock-add-keywords
2016-05-21 10:37:30 +08:00
nil `(("(\\(lambda\\)" (1 (doom/show-as )))
2016-05-25 10:15:44 +08:00
("(\\(\\(doom\\)\\([-:/|][^) ]*\\)?\\)[) \n]" (1 font-lock-builtin-face))
2016-05-21 10:37:30 +08:00
;; Highlight doom macros (macros are fontified in emacs 25+)
2016-05-11 17:36:49 +08:00
(,(concat
"(\\(def-"
(regexp-opt '("electric" "project-type" "company-backend"
2016-05-21 07:08:02 +08:00
"builder" "repl" "text-obj" "tmp-excmd" "rotate"
2016-05-25 09:57:25 +08:00
"repeat" "yas-mode" "version-cmd" "docset" "popup"
"open-with"))
2016-05-11 17:36:49 +08:00
"!\\)")
(1 font-lock-keyword-face append))
(,(concat
"(\\("
(regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook"
"associate" "define-org-link" "ex"
2016-05-24 04:52:21 +08:00
"define-org-section" "set" "noop"))
2016-05-11 17:36:49 +08:00
"!\\)")
(1 font-lock-keyword-face append))
;; Ert
2016-05-11 17:36:49 +08:00
(,(concat
"("
(regexp-opt '("ert-deftest") t)
" \\([^ ]+\\)")
(1 font-lock-keyword-face)
(2 font-lock-function-name-face))))
2015-11-10 04:55:03 +08:00
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
2015-11-20 17:00:38 +08:00
2016-05-06 13:57:50 +08:00
(dolist (i '(("Evil Command" "\\(^\\s-*(evil-define-command +\\)\\(\\_<.+\\_>\\)" 2)
("Evil Operator" "\\(^\\s-*(evil-define-operator +\\)\\(\\_<.+\\_>\\)" 2)
2016-05-21 04:51:21 +08:00
("Package" "\\(^\\s-*(use-package +\\)\\(\\_<[^ \n]+\\_>\\)" 2)
2016-05-06 13:57:50 +08:00
("Spaceline Segment" "\\(^\\s-*(spaceline-define-segment +\\)\\(\\_<.+\\_>\\)" 2)))
(push i imenu-generic-expression)))
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
;; Add new colors to helm-imenu
(after! helm-imenu
(defun helm-imenu-transformer (candidates)
(cl-loop for (k . v) in candidates
for types = (or (helm-imenu--get-prop k)
(list "Function" k))
for bufname = (buffer-name (marker-buffer v))
for disp1 = (mapconcat
(lambda (x)
(propertize
x 'face (cond ((string= x "Variables")
'font-lock-variable-name-face)
((or (string= x "Function")
(string-prefix-p "Evil " x t))
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
'font-lock-function-name-face)
((string= x "Types")
'font-lock-type-face)
((string= x "Package")
'font-lock-negation-char-face)
((string= x "Spaceline Segment")
'font-lock-string-face))))
types helm-imenu-delimiter)
for disp = (propertize disp1 'help-echo bufname)
collect
(cons disp (cons k v)))))
2015-11-08 05:57:24 +08:00
2015-11-11 07:10:32 +08:00
2016-05-21 07:08:02 +08:00
;;
(use-package highlight-quoted
:commands (highlight-quoted-mode)
:init (add-hook 'emacs-lisp-mode-hook 'highlight-quoted-mode))
(use-package slime :defer t
:config (setq inferior-lisp-program "clisp"))
2016-05-22 11:08:42 +08:00
(use-package auto-compile
:commands (auto-compile-on-save-mode)
:init (add-hook 'emacs-lisp-mode-hook 'auto-compile-on-save-mode)
:config (setq auto-compile-display-buffer nil))
2016-05-21 07:08:02 +08:00
2016-04-19 14:08:48 +08:00
;;
(def-project-type! emacs-ert "ert"
2016-04-17 09:36:24 +08:00
:modes (emacs-lisp-mode)
:match "/test/.+-test\\.el$"
:bind (:localleader
2016-05-21 10:37:30 +08:00
:n "tr" 'doom/ert-rerun-test
:n "ta" 'doom/ert-run-all-tests
:n "ts" 'doom/ert-run-test)
(add-hook 'ert-results-mode-hook 'doom-hide-mode-line-mode))
2015-11-24 16:44:17 +08:00
2016-05-24 04:52:21 +08:00
(provide 'module-elisp)
2015-06-15 15:06:10 +08:00
;;; module-elisp.el ends here