about summary refs log tree commit diff stats
path: root/.emacs.d/lisp/init-emacs-lisp.el
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2021-08-17 12:49:19 +0100
committerDavid Morgan <djm_uk@protonmail.com>2021-08-17 12:49:19 +0100
commitd0db5660caa836755ea8c99471d816484ea9e837 (patch)
treec7d0456a58e450abaf34b489b0b31c58ddbc8557 /.emacs.d/lisp/init-emacs-lisp.el
parentc92b18514728245850d31531ce224a74eddfc5a6 (diff)
downloaddotfiles-d0db5660caa836755ea8c99471d816484ea9e837.tar.gz
Add new .emacs.d
Diffstat (limited to '.emacs.d/lisp/init-emacs-lisp.el')
-rw-r--r--.emacs.d/lisp/init-emacs-lisp.el52
1 files changed, 52 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-emacs-lisp.el b/.emacs.d/lisp/init-emacs-lisp.el
new file mode 100644
index 0000000..ed608c3
--- /dev/null
+++ b/.emacs.d/lisp/init-emacs-lisp.el
@@ -0,0 +1,52 @@
+;;; init-emacs-lisp.el --- Emacs Lisp Configuration File -*- lexical-binding: t -*-
+;;; Commentary:
+;; Based on prelude-emacs-lisp.el
+;;; Code:
+
+(require 'init-lisp)
+
+(use-package eldoc
+  :ensure nil
+  :diminish)
+
+(use-package elisp-slime-nav
+  :diminish)
+
+(use-package emacs
+  :ensure nil
+  :config
+  ;; From prelude-emacs-lisp.el
+  (defun recompile-elc-on-save ()
+    "Recompile your elc when saving an elisp file. (Adds buffer-local hook)"
+    (add-hook 'after-save-hook
+              (lambda ()
+                (when (and
+                       (string-prefix-p user-emacs-directory (file-truename buffer-file-name))
+                       (file-exists-p (byte-compile-dest-file buffer-file-name)))
+                  (emacs-lisp-byte-compile)))
+              nil
+              t))
+  ;; From prelude-emacs-lisp.el
+  (defun visit-ielm ()
+    "Switch to default `ielm' buffer.
+Start `ielm' if it's not already running."
+    (interactive)
+    (crux-start-or-switch-to 'ielm "*ielm*"))
+  :hook
+  (ielm-mode . (lambda ()
+                 (eldoc-mode +1)
+                 (rainbow-delimiters-mode +1)))
+  (emacs-lisp-mode . (lambda ()
+                       (eldoc-mode +1)
+                       (rainbow-mode +1)
+                       (rainbow-delimiters-mode +1)
+                       (setq mode-name "EL")
+                       (recompile-elc-on-save)))
+  :bind
+  (:map emacs-lisp-mode-map
+        (("C-c C-z" . visit-ielm)
+         ("C-c C-c" . eval-defun)
+         ("C-c C-b" . eval-buffer))))
+
+(provide 'init-emacs-lisp)
+;;; init-emacs-lisp.el ends here