From 32196db8f8ddab071565a5ae6d799ada4f8fbe6b Mon Sep 17 00:00:00 2001 From: Antero Mejr Date: Sat, 7 Sep 2024 20:43:28 +0000 Subject: Improve geiser-repl-superparen-mode compatibility This change to `geiser-repl--superparen-function' improves compatibility with electric-pair-mode, as the procedure will no longer add too many parentheses. --- elisp/geiser-repl.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index 3bde43e..2cd7729 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -852,7 +852,12 @@ evaluated without having to press ENTER." (defun geiser-repl--superparen-function () (when (char-equal (char-before) geiser-repl-superparen-character) (delete-char -1) - (insert-char ?\) (geiser-repl--nesting-level)))) + (let ((level (geiser-repl--nesting-level))) + (if (memq nil (mapcar (lambda (idx) + (= (char-after idx) ?\))) + (number-sequence (point) (- (+ (point) level) 1)))) + (insert-char ?\) level) + (forward-char level))))) (defvar-local geiser-repl-superparen-mode-string " S" "Modeline indicator for geiser-repl-superparen-mode") -- cgit v1.2.3