From 445d176b2a593a87afd3f6bca717feba639dfbdc Mon Sep 17 00:00:00 2001 From: Rahguzar Date: Sat, 6 Jan 2024 12:32:57 +0100 Subject: Replace 'switch-to-buffer' with 'display-buffer' or 'pop-to-buffer' This allows user to customize how buffers get shown using 'display-buffer-alist'. Also refactors mastodon-auth--show-notice. --- lisp/mastodon-http.el | 1 - 1 file changed, 1 deletion(-) (limited to 'lisp/mastodon-http.el') diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index a357672..541c92e 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -240,7 +240,6 @@ Callback to `mastodon-http--get-response-async', usually (defun mastodon-http--process-headers () "Return an alist of http response headers." - (switch-to-buffer (current-buffer)) (goto-char (point-min)) (let* ((head-str (buffer-substring-no-properties (point-min) -- cgit v1.2.3 From 5e31b1b484736b771b58a5d153b7e6e8f22cb364 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 20 Feb 2024 09:52:02 +0100 Subject: http: some hack error handling in get-response --- lisp/mastodon-http.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lisp/mastodon-http.el') diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index 541c92e..a345324 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -179,8 +179,14 @@ PARAMS is an alist of any extra parameters to send with the request. SILENT means don't message. NO-HEADERS means don't collect http response headers. VECTOR means return json arrays as vectors." - (with-current-buffer (mastodon-http--get url params silent) - (mastodon-http--process-response no-headers vector))) + (let ((buf (mastodon-http--get url params silent))) + ;; (if (not buf) + ;; (error "Request returned nada") + (condition-case x + (with-current-buffer buf + (mastodon-http--process-response no-headers vector)) + (wrong-type-argument + (error "Request returned nada"))))) (defun mastodon-http--get-json (url &optional params silent vector) "Return only JSON data from URL request. -- cgit v1.2.3 From 5977495b8a7d2782b36723289e805f018375275b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 21 Feb 2024 10:26:53 +0100 Subject: move condition case from http get-response to credential-account --- lisp/mastodon-http.el | 9 ++------- lisp/mastodon.el | 7 ++++++- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'lisp/mastodon-http.el') diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index a345324..aef8975 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -180,13 +180,8 @@ SILENT means don't message. NO-HEADERS means don't collect http response headers. VECTOR means return json arrays as vectors." (let ((buf (mastodon-http--get url params silent))) - ;; (if (not buf) - ;; (error "Request returned nada") - (condition-case x - (with-current-buffer buf - (mastodon-http--process-response no-headers vector)) - (wrong-type-argument - (error "Request returned nada"))))) + (with-current-buffer buf + (mastodon-http--process-response no-headers vector)))) (defun mastodon-http--get-json (url &optional params silent vector) "Return only JSON data from URL request. diff --git a/lisp/mastodon.el b/lisp/mastodon.el index ffeee82..abc7787 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -315,7 +315,12 @@ FORCE means to fetch from the server and update nil :silent))) (if force (setq mastodon-profile-credential-account - (eval req)) + ;; TODO: we should also signal a quit condition after like 5 + ;; secs here + (condition-case x + (eval req) + (t ; req fails, return old value + mastodon-profile-credential-account))) (or mastodon-profile-credential-account (setq mastodon-profile-credential-account (eval req)))))) -- cgit v1.2.3