branch: elpa/geiser
commit 727347e968fe2e05ffd33992792acf036edef1cd
Author: terry <[email protected]>
Commit: terry <[email protected]>
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
---
elisp/geiser-repl.el | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index c43b9b28d3..1d130e50a7 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))