[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/el-job 73835a02a0 103/143: Try to be compatible with Em
From: |
ELPA Syncer |
Subject: |
[elpa] externals/el-job 73835a02a0 103/143: Try to be compatible with Emacs 28 |
Date: |
Sat, 22 Mar 2025 00:58:29 -0400 (EDT) |
branch: externals/el-job
commit 73835a02a00672cdc9c2e94ca05e4a3414ce0534
Author: Martin Edström <meedstrom91@gmail.com>
Commit: Martin Edström <meedstrom91@gmail.com>
Try to be compatible with Emacs 28
---
el-job-child.el | 16 +++++++------
el-job.el | 74 +++++++++++++++++++++++++++++++--------------------------
2 files changed, 49 insertions(+), 41 deletions(-)
diff --git a/el-job-child.el b/el-job-child.el
index 9d253636ca..b604242188 100644
--- a/el-job-child.el
+++ b/el-job-child.el
@@ -47,7 +47,9 @@ FUNC comes from the :funcall argument of `el-job-launch'.
Benchmark how long FUNC took to handle each item, and
add that information to the final return value."
- ;; Receive injection
+ ;; Use `read-minibuffer' to receive what we got via `process-send-string'
+ ;; from parent. Could also use just `read', but that prints an unnecessary
+ ;; "Lisp expression: " into parent's process buffer it'd have to clean up.
(let ((vars (read-minibuffer ""))
(libs (read-minibuffer "")))
(dolist (var vars)
@@ -57,11 +59,11 @@ add that information to the final return value."
;; Begin infinite loop, treating each further input from parent as a list of
;; things to map to FUNC.
(catch 'die
- (while-let ((input (read-minibuffer "")))
- (when (eq input 'die)
- (throw 'die nil))
- (let ((current-time-list nil) ;; Fewer cons cells
- item start output metadata results)
+ (let ((current-time-list nil) ;; Fewer cons cells
+ input item start output metadata results)
+ (while (setq input (read-minibuffer ""))
+ (when (eq input 'die)
+ (throw 'die nil))
(if input
(while input
(setq item (pop input))
@@ -74,7 +76,7 @@ add that information to the final return value."
;; `results' gets longer, then that is not a good benchmark of
;; `item'. Someone with more Lisp-fu could tell me.
(setq results (el-job-child--zip output results)))
- (funcall func)) ;; ??
+ (funcall func)) ;; Job with no inputs.
;; Ensure durations are in same order that ITEMS came in, letting us
;; associate which with which just by index.
(setq metadata (nreverse metadata))
diff --git a/el-job.el b/el-job.el
index e3723fb3e4..c06babf44f 100644
--- a/el-job.el
+++ b/el-job.el
@@ -203,8 +203,9 @@ being saddled with a huge item in addition to the average
workload."
(el-job--split-evenly items n-cores))
((progn
(dolist (item items)
- (when-let* ((dur (gethash item benchmarks)))
- (setq total-duration (time-add total-duration dur))))
+ (let ((dur (gethash item benchmarks)))
+ (when dur
+ (setq total-duration (time-add total-duration dur)))))
(eq total-duration 0))
;; Probably a first-time run
(el-job--split-evenly items n-cores))
@@ -214,9 +215,10 @@ being saddled with a huge item in addition to the average
workload."
this-sublist
sublists
untimed
- dur)
+ dur
+ item)
(catch 'filled
- (while-let ((item (pop items)))
+ (while (setq item (pop items))
(if (length= sublists n-cores)
(progn (push item items)
(throw 'filled t))
@@ -271,7 +273,7 @@ Cf. `with-slots' in the eieio library, or `let-alist'.
For clarity inside BODY, each symbol name in SLOTS must be prepended
with one character of your choosing, such as a dot."
- (declare (indent 2) (debug ((&rest (symbolp sexp)))))
+ (declare (indent 2))
`(cl-symbol-macrolet
,(cl-loop
for slot in slots
@@ -525,16 +527,17 @@ should trigger `el-job--handle-output'."
(print-symbols-bare t)
(print-escape-newlines t)
items proc)
- (while splits
- (setq items (pop splits))
- (setq proc (pop .ready))
- (push proc .busy)
- (push (process-buffer proc) busy-bufs)
- (setf (alist-get proc .input-sets) items)
- (with-current-buffer (process-buffer proc)
- (erase-buffer)
- (process-send-string proc (prin1-to-string items))
- (process-send-string proc "\n"))))
+ (while (progn
+ (setq items (pop splits))
+ (setq proc (pop .ready))
+ (push proc .busy)
+ (push (process-buffer proc) busy-bufs)
+ (setf (alist-get proc .input-sets) items)
+ (with-current-buffer (process-buffer proc)
+ (erase-buffer)
+ (process-send-string proc (prin1-to-string items))
+ (process-send-string proc "\n"))
+ splits)))
(setf .queued-inputs nil)
(plist-put .timestamps :work-begun (current-time))
(setf .poll-timer (run-with-timer .02 nil #'el-job--poll 1 busy-bufs)))))
@@ -557,6 +560,7 @@ should trigger `el-job--handle-output'."
;; but spread out the last 7 polls between T-minus-20s and T-minus-30s.
(defun el-job--poll (n bufs)
+ (cl-assert (not (null bufs)))
(let (busy-bufs id)
(save-current-buffer
(dolist (buf bufs)
@@ -566,15 +570,16 @@ should trigger `el-job--handle-output'."
(if (eq (char-before) ?\n)
(el-job--handle-output)
(push buf busy-bufs))))
- (if (and busy-bufs (<= n 42))
- (setf (el-job:poll-timer el-job-here)
- (run-with-timer
- (/ n (float (ash 1 5))) nil #'el-job--poll (1+ n) busy-bufs))
- (setq id (el-job:id el-job-here))
- (el-job--disable el-job-here)
- (if busy-bufs
- (message "el-job: Timed out, was busy for 30+ seconds: %s" id)
- (el-job--dbg 2 "Reaped idle processes for %s" id))))))
+ (when bufs
+ (if (and busy-bufs (<= n 42))
+ (setf (el-job:poll-timer el-job-here)
+ (run-with-timer
+ (/ n (float (ash 1 5))) nil #'el-job--poll (1+ n)
busy-bufs))
+ (setq id (el-job:id el-job-here))
+ (el-job--disable el-job-here)
+ (if busy-bufs
+ (message "el-job: Timed out, was busy for 30+ seconds: %s" id)
+ (el-job--dbg 2 "Reaped idle processes for %s" id)))))))
(defun el-job--handle-output ()
"Handle output in current buffer.
@@ -660,14 +665,15 @@ same ID still has the benchmarks table and possibly
queued input."
Tip: alternatively, you can preserve the process buffers for inspection.
Use \\[el-job-cycle-debug-level] and they are not killed from then on."
(interactive)
- (when-let* ((id (intern (completing-read "Get info on job: " el-jobs)))
- (job (gethash id el-jobs)))
- (set-buffer (get-buffer-create "*el-job debug info*" t))
- (so-long-mode)
- (let ((inhibit-read-only t))
- (erase-buffer)
- (prin1 job (current-buffer)))
- (switch-to-buffer (current-buffer))))
+ (let* ((id (intern (completing-read "Get info on job: " el-jobs)))
+ (job (gethash id el-jobs)))
+ (when job
+ (set-buffer (get-buffer-create "*el-job debug info*" t))
+ (so-long-mode)
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (prin1 job (current-buffer)))
+ (switch-to-buffer (current-buffer)))))
(defun el-job-kill-all ()
"Kill all el-jobs ever registered and forget metadata."
@@ -697,8 +703,8 @@ Meanwhile, ensure string MESSAGE is visible in the
minibuffer."
(defun el-job-is-busy (id)
"Return list of busy processes for job ID, if any.
Safely return nil otherwise, whether or not ID is known."
- (when-let* ((job (gethash id el-jobs)))
- (el-job:busy job)))
+ (let ((job (gethash id el-jobs)))
+ (and job (el-job:busy job))))
(provide 'el-job)
- [elpa] externals/el-job a5f9e72c17 018/143: Clean, (continued)
- [elpa] externals/el-job a5f9e72c17 018/143: Clean, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 3b3b800153 019/143: Add an autoload for easier load-path checks, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 10ba5197e3 032/143: Add an error-catch, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 70bdb8fea5 055/143: Polish, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job d045f9a390 045/143: Switch most uses of time-convert to current-time, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job bddf5f373e 054/143: Fix a missing reference, and replace slot "results" w two new slots, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 44ef7d1026 082/143: Revert "Release version 1.0.4", ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 127b68e005 080/143: Release version 1.0.4, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job cd57ff919e 089/143: Use a poll timer rather than after-change-functions, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job ffb216b52d 093/143: Don't record cores-to-use in struct, always use max, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 73835a02a0 103/143: Try to be compatible with Emacs 28,
ELPA Syncer <=
- [elpa] externals/el-job 006af3ffd4 104/143: DROP SUPPORT Emacs 28, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 455e198d47 111/143: CI, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job a70b492bf4 105/143: Release version 2.1.0, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 0b180cc276 112/143: Comments, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 58699f2328 116/143: Lint, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 99c31acdb3 131/143: Update outdated comments in el-job-child.el, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 68237f09c3 134/143: Follow elisp convention, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 268102c786 138/143: Oops, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 40f86f79fc 028/143: Clarifications, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 252c669cd5 042/143: Move code around, ELPA Syncer, 2025/03/22