1
0
Fork 0

[oni-scheme] Disable the paredit newline keybindings in Geiser REPL

This commit is contained in:
Tom Willemse 2023-07-18 21:21:46 -07:00
parent 467160bbf8
commit fe81a684b0

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2021.1123.003531 ;; Version: 2023.0718.212002
;; Package-Requires: (oni-company oni-paredit rainbow-delimiters geiser geiser-guile) ;; Package-Requires: (oni-company oni-paredit rainbow-delimiters geiser geiser-guile)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -35,6 +35,16 @@
(setq-local comment-auto-fill-only-comments t) (setq-local comment-auto-fill-only-comments t)
(auto-fill-mode)) (auto-fill-mode))
(defun oni-scheme-geiser-repl-remove-paredit-newline-keys ()
"Disable C-j and RET keybindings from geiser-repl-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)))
(add-hook 'scheme-mode-hook 'company-mode) (add-hook 'scheme-mode-hook 'company-mode)
(add-hook 'scheme-mode-hook 'display-fill-column-indicator-mode) (add-hook 'scheme-mode-hook 'display-fill-column-indicator-mode)
(add-hook 'scheme-mode-hook 'oni-scheme--auto-fill-mode) (add-hook 'scheme-mode-hook 'oni-scheme--auto-fill-mode)
@ -42,6 +52,9 @@
(add-hook 'scheme-mode-hook 'rainbow-delimiters-mode) (add-hook 'scheme-mode-hook 'rainbow-delimiters-mode)
(add-hook 'geiser-repl-mode-hook 'paredit-mode) (add-hook 'geiser-repl-mode-hook 'paredit-mode)
;;; Make sure this gets added _after_ paredit-mode so that it gets executed
;;; later.
(add-hook 'geiser-repl-mode-hook #'oni-scheme-geiser-repl-remove-paredit-newline-keys 90)
(setq geiser-default-implementation 'guile) (setq geiser-default-implementation 'guile)