From c9eb00a21716151d3d9e6d002496b3f15e6e8bf1 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 28 Mar 2021 00:32:27 -0400 Subject: [PATCH] Fix incorrect newline placement on send-to-REPL Sending this form to a REPL (like ielm): (defun test (n) ...) Will yield: (defun test (n ...)) Because our RET emulation doesn't take evil's off-by-one cursor placement into account. --- modules/tools/eval/autoload/repl.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/tools/eval/autoload/repl.el b/modules/tools/eval/autoload/repl.el index f169e747f..9cb0e8227 100644 --- a/modules/tools/eval/autoload/repl.el +++ b/modules/tools/eval/autoload/repl.el @@ -132,9 +132,11 @@ immediately after." (insert line) (if inhibit-auto-execute-p (insert "\n") - ;; `comint-send-input' isn't enough because some REPLs may not use - ;; comint, so just emulate the keypress. - (execute-kbd-macro (kbd "RET"))) + ;; Can't use `comint-send-input' b/c there's no guarantee the + ;; current REPL uses comint. Even if it did, no telling if they + ;; have their own `comint-send-input' wrapper, so to be safe, I + ;; simply emulate the keypress. + (call-interactively (doom-lookup-key (kbd "RET")))) (sit-for 0.001) (redisplay 'force))) (when (and (eq origin-window (selected-window))