[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.
- [elpa] externals/plz d6dfe3b27a 11/40: Tidy: Remove plz-result, (continued)
- [elpa] externals/plz d6dfe3b27a 11/40: Tidy: Remove plz-result, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 85ac0fbe38 15/40: WIP: Use sentinel value; add comments, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 7d197e968a 20/40: Change: (plz--respond) Don't catch errors from THEN/ELSE, ELPA Syncer, 2023/06/26
- [elpa] externals/plz a2c20b1437 24/40: Comment: TODO, ELPA Syncer, 2023/06/26
- [elpa] externals/plz f551c1bd49 25/40: Tidy: (plz--respond), ELPA Syncer, 2023/06/26
- [elpa] externals/plz de8e21f81d 29/40: Tidy: Docstrings, ELPA Syncer, 2023/06/26
- [elpa] externals/plz f9f95a8544 34/40: Comment: Add TODO, ELPA Syncer, 2023/06/26
- [elpa] externals/plz c786bbf7d2 35/40: Tidy/Comment, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 438162db4e 13/40: WIP: Add request args to sentinel error, ELPA Syncer, 2023/06/26
- [elpa] externals/plz a1f8a10b0b 16/40: Comment: Add FIXME, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 880223e7c0 22/40: Tidy: (plz--sentinel),
ELPA Syncer <=
- [elpa] externals/plz 53ef6a16ce 26/40: Comment: Tidy, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 582f0c5bb8 31/40: Tests: Enable continue-on-error for linting, ELPA Syncer, 2023/06/26
- [elpa] externals/plz b896c41d71 32/40: Change: Generate buffer for STDERR, ELPA Syncer, 2023/06/26
- [elpa] externals/plz d2a7368699 37/40: Tidy: (plz) Don't switch to process-buffer, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 9319470060 38/40: Merge branch 'wip/no-signal-from-sentinel-as-timer', ELPA Syncer, 2023/06/26
- [elpa] externals/plz 5e63662e21 40/40: Docs: Update changelog, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 0cb20bc74d 03/40: Tidy, ELPA Syncer, 2023/06/26
- [elpa] externals/plz e28b4e8b6a 06/40: Tidy, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 8f263bfd0f 09/40: Comment: Remove old TODO, ELPA Syncer, 2023/06/26
- [elpa] externals/plz c181fd1565 10/40: Tidy: Error handling in THEN function, ELPA Syncer, 2023/06/26