1
0
Fork 0

[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.
This commit is contained in:
Tom Willemse 2023-04-11 20:20:57 -07:00
parent 1de5e3892c
commit c76c236991

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; 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) ;; 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 ;; This program is free software; you can redistribute it and/or modify
@ -84,6 +84,16 @@
(:eval (buffer-name ielm-working-buffer)) (:eval (buffer-name ielm-working-buffer))
mode-line-end-spaces))) 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) (defhydra oni-elisp-hydra (:color teal :hint nil)
" "
^Eval^ ^Eval^
@ -102,6 +112,7 @@ _eb_: Buffer
(add-hook 'emacs-lisp-mode-hook 'paredit-mode) (add-hook 'emacs-lisp-mode-hook 'paredit-mode)
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-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 #'oni-elisp-setup-ielm-mode-line)
(add-hook 'ielm-mode-hook 'company-mode) (add-hook 'ielm-mode-hook 'company-mode)
(add-hook 'ielm-mode-hook 'paredit-mode) (add-hook 'ielm-mode-hook 'paredit-mode)