diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-08-10 15:58:47 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-08-10 15:58:47 +0100 |
commit | 8a9dfe222b9cb75492abd6a53a96bc648d0579af (patch) | |
tree | e1abe20e0573d01d4cb88a4272b853a01eae222c | |
parent | 2b8de54c83d50020e16e996b3f24372069c6b5aa (diff) | |
download | dotfiles-8a9dfe222b9cb75492abd6a53a96bc648d0579af.tar.gz |
Add eval-region-or-defun
-rw-r--r-- | .emacs.d/lisp/init-emacs-lisp.el | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/.emacs.d/lisp/init-emacs-lisp.el b/.emacs.d/lisp/init-emacs-lisp.el index 0608e03..7642ca9 100644 --- a/.emacs.d/lisp/init-emacs-lisp.el +++ b/.emacs.d/lisp/init-emacs-lisp.el @@ -14,6 +14,12 @@ (use-package emacs :config + (defun eval-region-or-defun (edebug-it) + "Call eval-region, if one is selected, or eval-defun otherwise." + (interactive "P") + (if (use-region-p) + (eval-region (region-beginning) (region-end)) + (eval-defun edebug-it))) ;; Based on prelude-emacs-lisp.el (defun recompile-init-lisp () (when (and @@ -42,7 +48,8 @@ Start `ielm' if it's not already running." :bind (:map emacs-lisp-mode-map (("C-c C-z" . visit-ielm) - ("C-c C-c" . eval-defun) + ("C-M-x" . eval-region-or-defun) + ("C-c C-c" . eval-region-or-defun) ("C-c C-b" . eval-buffer) ("C-c e f" . emacs-lisp-byte-compile-and-load) ("C-c e z" . byte-recompile-directory) |