             ("Functions" "^\\s-*(\\(?:cl-\\)?def\\(?:un\\|un\\*\\|method\\|generic\\|-memoized!\\) +\\([^ ,)\n]+\\)" 1)
             ("Variables" "^\\s-*(\\(def\\(?:c\\(?:onst\\(?:ant\\)?\\|ustom\\)\\|ine-symbol-macro\\|parameter\\)\\)\\s-+\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2)
             ("Variables" "^\\s-*(defvar\\(?:-local\\)?\\s-+\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)[[:space:]\n]+[^)]" 1)
-            ("Types" "^\\s-*(\\(cl-def\\(?:struct\\|type\\)\\|def\\(?:class\\|face\\|group\\|ine-\\(?:condition\\|error\\|widget\\)\\|package\\|struct\\|t\\(?:\\(?:hem\\|yp\\)e\\)\\)\\)\\s-+'?\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2)
-            ))))
+            ("Types" "^\\s-*(\\(cl-def\\(?:struct\\|type\\)\\|def\\(?:class\\|face\\|group\\|ine-\\(?:condition\\|error\\|widget\\)\\|package\\|struct\\|t\\(?:\\(?:hem\\|yp\\)e\\)\\)\\)\\s-+'?\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2))))
+
+  (defun +emacs-lisp|init-flycheck ()
+    "Initialize flycheck-mode if not in emacs.d."
+    (when (and buffer-file-name
+               (not (file-in-directory-p buffer-file-name doom-emacs-dir)))
+      (flycheck-mode +1))))
 
 
 ;;

                   ("add-hook" "remove-hook")
                   ("add-hook!" "remove-hook!")))

  (defun +emacs-lisp|hook ()
    (add-hook 'before-save-hook #'delete-trailing-whitespace nil t)

    (eldoc-mode +1)
    (auto-compile-on-save-mode +1)

    (when (and buffer-file-name
               (not (file-in-directory-p buffer-file-name doom-emacs-dir)))
      (flycheck-mode +1))

    ;; improve fontification
    (rainbow-delimiters-mode +1)
    (highlight-quoted-mode +1)
    (highlight-numbers-mode +1)
    (font-lock-add-keywords
     nil `(;; Display "lambda" as λ
           ("(\\(lambda\\)" (1 (ignore (compose-region (match-beginning 1) (match-end 1) ?λ #'decompose-region))))
           ;; Highlight doom/module functions
           ("\\(^\\|\\s-\\|,\\)(\\(\\(doom\\|\\+\\)[^) ]+\\)[) \n]" (2 font-lock-keyword-face))))

    (setq imenu-generic-expression
          '(("Evil Commands" "^\\s-*(evil-define-\\(?:command\\|operator\\|motion\\) +\\(\\_<[^ ()\n]+\\_>\\)" 1)
            ("Package" "^\\s-*(\\(?:def-\\)?package! +\\(\\_<[^ ()\n]+\\_>\\)" 1)


(def-package! elisp-mode ; built-in
  :mode ("/Cask$" . emacs-lisp-mode)
  :config
  (set! :repl 'emacs-lisp-mode #'+emacs-lisp/repl)
  (set! :eval 'emacs-lisp-mode #'+emacs-lisp-eval)
