summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntero Mejr <mail@antr.me>2024-09-07 20:43:28 +0000
committerjao <jao@gnu.org>2024-09-07 23:35:34 +0100
commit32196db8f8ddab071565a5ae6d799ada4f8fbe6b (patch)
tree7f1aa30f5ad4fe328f5b0e78896c3613f8de848e
parentfb8439a7fdb81566873e69564438d2e82dc3f8a9 (diff)
downloadgeiser-32196db8f8ddab071565a5ae6d799ada4f8fbe6b.tar.gz
geiser-32196db8f8ddab071565a5ae6d799ada4f8fbe6b.tar.bz2
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.
-rw-r--r--elisp/geiser-repl.el7
1 files changed, 6 insertions, 1 deletions
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")