emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/plz 880223e7c0 22/40: Tidy: (plz--sentinel)


From: ELPA Syncer
Subject: [elpa] externals/plz 880223e7c0 22/40: Tidy: (plz--sentinel)
Date: Mon, 26 Jun 2023 06:59:33 -0400 (EDT)

branch: externals/plz
commit 880223e7c0278405d32ad6f18c79b6eaec1bf997
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Tidy: (plz--sentinel)
---
 plz.el | 41 +++++++++++++----------------------------
 1 file changed, 13 insertions(+), 28 deletions(-)

diff --git a/plz.el b/plz.el
index 6bc1c82eef..a703bdd383 100644
--- a/plz.el
+++ b/plz.el
@@ -723,34 +723,19 @@ Includes active and queued requests."
 ;;;;; Private
 
 (defun plz--sentinel (process status)
-  ;; FIXME: Update docstring for arguments.
-  "Process buffer of curl output in PROCESS-OR-BUFFER.
-If PROCESS-OR-BUFFER if a process, uses its buffer; if a buffer,
-uses it.  STATUS should be the process's event string (see info
-node `(elisp) Sentinels').  Kills the buffer before returning."
-  ;; Inspired by and some code copied from `elfeed-curl--sentinel'.
-  (let ((buffer (process-buffer process)))
-    (with-current-buffer buffer
-      (pcase status
-        ((or 0 "finished\n")
-         ;; Curl exited normally: check HTTP status code.
-         (if plz-sync
-             (plz--respond process buffer status)
-           (run-at-time 0 nil #'plz--respond process buffer status)))
-
-        ((or (and (pred numberp) code)
-             (rx "exited abnormally with code " (let code (group (1+ digit)))))
-         ;; Curl error.
-         (ignore code)
-         (if plz-sync
-             (plz--respond process buffer status)
-           (run-at-time 0 nil #'plz--respond process buffer status)))
-
-        ((and (or "killed\n" "interrupt\n") status)
-         ;; Curl process killed or interrupted.
-         (if plz-sync
-             (plz--respond process buffer status)
-           (run-at-time 0 nil #'plz--respond process buffer status)))))))
+  "Sentinel for curl PROCESS.
+STATUS should be the process's event string (see info
+node `(elisp) Sentinels').  Calls `plz--respond' to process the
+HTTP response (directly for synchronous requests, or from a timer
+for asynchronous ones)."
+  (pcase status
+    ((or "finished\n" "killed\n" "interrupt\n"
+         (pred numberp)
+         (rx "exited abnormally with code " (group (1+ digit))))
+     (let ((buffer (process-buffer process)))
+       (if (buffer-local-value 'plz-sync buffer)
+           (plz--respond process buffer status)
+         (run-at-time 0 nil #'plz--respond process buffer status))))))
 
 (defun plz--respond (process buffer status)
   "Respond to HTTP response from PROCESS in BUFFER.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]