[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:
parent
1de5e3892c
commit
c76c236991
1 changed files with 12 additions and 1 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue