From c0ffce0849c8596d763d0ad603b9d67f75e93161 Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Sat, 5 Aug 2023 17:41:35 -0700 Subject: [PATCH] gptel: Fix reading bounds in org files (#98) * gptel.el (gptel--restore-state): When there is no "GPTEL_BOUNDS" org property, `read' asks for stdin instead. Fix by only calling `read' when this property is non-nil. Thanks to @Elilif for spotting this bug. --- gptel.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gptel.el b/gptel.el index 4602625..0871826 100644 --- a/gptel.el +++ b/gptel.el @@ -331,11 +331,10 @@ Currently saving and restoring state is implemented only for (widen) (condition-case-unless-debug nil (progn - (when-let ((bounds - (read (org-entry-get (point-min) "GPTEL_BOUNDS")))) + (when-let ((bounds (org-entry-get (point-min) "GPTEL_BOUNDS"))) (mapc (pcase-lambda (`(,beg . ,end)) (put-text-property beg end 'gptel 'response)) - bounds) + (read bounds)) (message "gptel chat restored.")) (when-let ((model (org-entry-get (point-min) "GPTEL_MODEL"))) (setq-local gptel-model model))