aboutsummaryrefslogtreecommitdiff
path: root/wttrin-debug.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-04-04 12:34:34 -0500
committerCraig Jennings <c@cjennings.net>2026-04-04 12:34:34 -0500
commitf33d7231fa7f9f11250a592e28601df6b8f564c7 (patch)
tree45d44a7076e1c731033bc914e7e7a8af4c5b4108 /wttrin-debug.el
parentea5636c51361b86d132d647ee3548d208394878e (diff)
downloademacs-wttrin-f33d7231fa7f9f11250a592e28601df6b8f564c7.tar.gz
emacs-wttrin-f33d7231fa7f9f11250a592e28601df6b8f564c7.zip
fix: debug-wttrin-show-raw broken by async API change
debug-wttrin-show-raw called wttrin--get-cached-or-fetch with 1 arg, but the function now requires 2 (location + callback) since the async refactor. Rewrote to use the callback pattern. Also handles nil response gracefully.
Diffstat (limited to 'wttrin-debug.el')
-rw-r--r--wttrin-debug.el29
1 files changed, 16 insertions, 13 deletions
diff --git a/wttrin-debug.el b/wttrin-debug.el
index a0576a4..e1d4697 100644
--- a/wttrin-debug.el
+++ b/wttrin-debug.el
@@ -41,19 +41,22 @@
"Fetch and display raw wttr.in data for LOCATION with line numbers.
This is useful for debugging header parsing issues."
(interactive "sLocation: ")
- (let ((raw-string (wttrin--get-cached-or-fetch location)))
- (with-current-buffer (get-buffer-create "*wttrin-debug*")
- (erase-buffer)
- (insert raw-string)
- (goto-char (point-min))
- (let ((line-num 1))
- (while (not (eobp))
- (beginning-of-line)
- (insert (format "%2d: " line-num))
- (setq line-num (1+ line-num))
- (forward-line 1)))
- (goto-char (point-min))
- (switch-to-buffer (current-buffer)))))
+ (wttrin--get-cached-or-fetch
+ location
+ (lambda (raw-string)
+ (with-current-buffer (get-buffer-create "*wttrin-debug*")
+ (erase-buffer)
+ (when raw-string
+ (insert raw-string))
+ (goto-char (point-min))
+ (let ((line-num 1))
+ (while (not (eobp))
+ (beginning-of-line)
+ (insert (format "%2d: " line-num))
+ (setq line-num (1+ line-num))
+ (forward-line 1)))
+ (goto-char (point-min))
+ (switch-to-buffer (current-buffer))))))
;;;###autoload
(defun debug-wttrin-enable ()