aboutsummaryrefslogtreecommitdiffstats
path: root/oni-elisp
diff options
context:
space:
mode:
authorGravatar Tom Willemse2023-04-11 20:20:57 -0700
committerGravatar Tom Willemse2023-04-11 20:20:57 -0700
commitc76c23699179fd69060f005d1ba43e001972abc6 (patch)
tree36eb7e630ede8306424d16c670a27f0669781c17 /oni-elisp
parent1de5e3892cd22f3c2324865753149769afd3b2c3 (diff)
downloademacs-config-c76c23699179fd69060f005d1ba43e001972abc6.tar.gz
emacs-config-c76c23699179fd69060f005d1ba43e001972abc6.zip
[oni-elisp] Fix keybindings for IELM
‘paredit-mode’ appears to have added keybindings for ‘C-j’ and ‘RET’ that weren't there before (or did I enable ‘paredit-mode’ in IELM recently?) and that interfere with executing code. This way of removing the keybindings works in a buffer-local only way so that in other buffers the ‘RET’ and ‘C-j’ keybindings remain untouched.
Diffstat (limited to 'oni-elisp')
-rw-r--r--oni-elisp/oni-elisp.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/oni-elisp/oni-elisp.el b/oni-elisp/oni-elisp.el
index 80834f3..30475ef 100644
--- a/oni-elisp/oni-elisp.el
+++ b/oni-elisp/oni-elisp.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2023.0314.001059
+;; Version: 2023.0411.133217
;; Package-Requires: (oni-company oni-flycheck oni-paredit oni-yasnippet oni-hydra rainbow-delimiters nameless erefactor flycheck-relint handle elisp-format)
;; This program is free software; you can redistribute it and/or modify
@@ -84,6 +84,16 @@
(:eval (buffer-name ielm-working-buffer))
mode-line-end-spaces)))
+(defun oni-elisp-ielm-remove-paredit-newline-keys ()
+ "Disable ‘C-j’ and ‘RET’ keybindings from ‘paredit-mode’."
+ (let ((oldmap (map-elt minor-mode-map-alist 'paredit-mode))
+ (newmap (make-sparse-keymap)))
+ (set-keymap-parent newmap oldmap)
+ (define-key newmap (kbd "RET") nil)
+ (define-key newmap (kbd "C-j") nil)
+ (make-local-variable 'minor-mode-overriding-map-alist)
+ (push `(paredit-mode . ,newmap) minor-mode-overriding-map-alist)))
+
(defhydra oni-elisp-hydra (:color teal :hint nil)
"
^Eval^
@@ -102,6 +112,7 @@ _eb_: Buffer
(add-hook 'emacs-lisp-mode-hook 'paredit-mode)
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
+(add-hook 'ielm-mode-hook #'oni-elisp-ielm-remove-paredit-newline-keys)
(add-hook 'ielm-mode-hook #'oni-elisp-setup-ielm-mode-line)
(add-hook 'ielm-mode-hook 'company-mode)
(add-hook 'ielm-mode-hook 'paredit-mode)