summaryrefslogtreecommitdiff
path: root/elisp/geiser-repl.el
diff options
context:
space:
mode:
authorterry <terry.cadd@gmail.com>2026-07-15 23:06:58 +0100
committerterry <terry.cadd@gmail.com>2026-07-15 23:06:58 +0100
commit727347e968fe2e05ffd33992792acf036edef1cd (patch)
tree87b722658380ce97dfc49ee66d104eb73ee311d9 /elisp/geiser-repl.el
parent84c25e9683a18d00387b6c16b0cee66269536c3c (diff)
downloadgeiser-727347e968fe2e05ffd33992792acf036edef1cd.tar.gz
geiser-727347e968fe2e05ffd33992792acf036edef1cd.tar.bz2
fix(repl): prevent wrong-type-argument stringp nil
using chicken scheme 5.4.0 and geiser i was getting this message repeatedly after every expression entered in repl geiser-repl--output-filter: Wrong type argument: stringp, nil in my case (geiser-con--connection-debug-prompt geiser-repl--connection) evaluated to nil causing string-match-p to error out (defun geiser-repl--matches-prompt-p (txt) ... txt was found to be the empty string most times "" essential reduces to (string-match-p nil "") so put some conditional pieces for txt is not a string, if string is empty , no point checking since not a prompt just use conjunction and to prevent string-match-p on nil on both prompts and use disjunction or to get next prompt type if first failed to match thnaks
Diffstat (limited to 'elisp/geiser-repl.el')
-rw-r--r--elisp/geiser-repl.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index c43b9b2..1d130e5 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -586,12 +586,13 @@ to standard output face."
geiser-repl--last-output-end)))
(defun geiser-repl--matches-prompt-p (txt)
- (or (string-match-p
- (geiser-con--connection-prompt geiser-repl--connection)
- txt)
- (string-match-p
- (geiser-con--connection-debug-prompt geiser-repl--connection)
- txt)))
+ (cond
+ ((not (stringp txt)) nil)
+ ((string-empty-p txt) nil)
+ (t (or (let ((prompt1 (geiser-con--connection-prompt geiser-repl--connection)))
+ (and prompt1 (string-match-p prompt1 txt)))
+ (let ((prompt2 (geiser-con--connection-debug-prompt geiser-repl--connection)))
+ (and prompt2 (string-match-p prompt2 txt)))))))
(defun geiser-repl--output-filter (txt)
(when (geiser-repl--find-output-region) (geiser-repl--treat-output-region))