[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/plz 85ac0fbe38 15/40: WIP: Use sentinel value; add comm
From: |
ELPA Syncer |
Subject: |
[elpa] externals/plz 85ac0fbe38 15/40: WIP: Use sentinel value; add comments |
Date: |
Mon, 26 Jun 2023 06:59:32 -0400 (EDT) |
branch: externals/plz
commit 85ac0fbe383f270c57fabc434e07aaba8956f11c
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
WIP: Use sentinel value; add comments
---
plz.el | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/plz.el b/plz.el
index b318a33c0d..c0a61db36c 100644
--- a/plz.el
+++ b/plz.el
@@ -496,6 +496,10 @@ NOQUERY is passed to `make-process', which see."
(buffer (with-current-buffer body
(process-send-region process (point-min) (point-max))))))
(process-send-eof process)
+ ;; HACK: We set the result to a sentinel value so that any other
+ ;; value, even nil, means that the response was processed, and
+ ;; the sentinel does not need to be called again (see below).
+ (process-put process :plz-result :plz-result)
(if sync-p
(unwind-protect
(progn
@@ -504,18 +508,30 @@ NOQUERY is passed to `make-process', which see."
(error "Process unexpectedly nil"))
(while (accept-process-output process))
(while (accept-process-output (get-buffer-process
stderr-buffer)))
- (unless (process-get process :plz-result)
+ (when (eq :plz-result (process-get process :plz-result))
+ ;; HACK: Sentinel seems to not have been called:
+ ;; call it again. (Although this is a hack, it
+ ;; seems to be a necessary one due to Emacs's
+ ;; process handling.)
+ ;; FIXME: Add link to relevant bug reports.
(plz--sentinel process "finished\n")
- (unless (process-get process :plz-result)
- (error "NO RESULT FROM PROCESS:%S BUFFER-STRING:%S"
process
- (buffer-string))))
+ (when (eq :plz-result (process-get process :plz-result))
+ (error "plz: NO RESULT FROM PROCESS:%S BUFFER-STRING:%S"
+ process (buffer-string))))
+ ;; Sentinel seems to have been called: check the result.
(pcase (process-get process :plz-result)
((and (pred plz-error-p) data)
+ ;; The AS function signaled an error, which was collected
+ ;; into a `plz-error' struct: re-signal the error here,
+ ;; outside of the sentinel.
(signal 'plz-error data))
- (else else)))
+ (else
+ ;; The AS function returned a value: return it.
+ else)))
(unless (eq as 'buffer)
(kill-buffer process-buffer))
(kill-buffer stderr-buffer))
+ ;; Async request: return the process object.
process)))))
;;;;; Queue
- [elpa] externals/plz updated (a8ae654530 -> 5e63662e21), ELPA Syncer, 2023/06/26
- [elpa] externals/plz 9ac623858c 01/40: WIP: Fix nil return value bugs, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 797963c035 02/40: WIP: Use separate buffer for STDERR, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 50d977288e 04/40: Fix: Set stderr process sentinel to #'ignore, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 0d4356640d 05/40: Change: Use only one error type, plz-error, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 046f29a816 08/40: Docs: Remove old TODO, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 81d1c61f1f 07/40: Tidy docstring and comment, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 56c92ff78e 12/40: Tidy, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 43231ac43c 14/40: WIP: Use timer for response parsing, ELPA Syncer, 2023/06/26
- [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 <=
- [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, 2023/06/26
- [elpa] externals/plz 53ef6a16ce 26/40: Comment: Tidy, ELPA Syncer, 2023/06/26