From fe81a684b02d072cfb9efa1f98d056e6d8a1932c Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 18 Jul 2023 21:21:46 -0700 Subject: [PATCH] [oni-scheme] Disable the paredit newline keybindings in Geiser REPL --- oni-scheme.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/oni-scheme.el b/oni-scheme.el index dfc5aa6..8b3ad09 100644 --- a/oni-scheme.el +++ b/oni-scheme.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2021.1123.003531 +;; Version: 2023.0718.212002 ;; Package-Requires: (oni-company oni-paredit rainbow-delimiters geiser geiser-guile) ;; This program is free software; you can redistribute it and/or modify @@ -35,6 +35,16 @@ (setq-local comment-auto-fill-only-comments t) (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 'display-fill-column-indicator-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 '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)