branch: externals/el-job commit 00c2ce983e749c019c4467e9f4a941014bd3f01f Author: Martin Edström <meedstro...@gmail.com> Commit: Martin Edström <meedstro...@gmail.com>
Style --- README.org | 2 +- el-job.el | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/README.org b/README.org index f1a5c4b284..3a8ccd322c 100644 --- a/README.org +++ b/README.org @@ -13,7 +13,7 @@ In the meantime, current Emacs does not hang at all. Best of all, it completes /faster/ than =(mapcar #'FN INPUTS)=, owing to the use of all CPU cores! -For real-world usage, search for =el-job-launch= in the source of [[https://github.com/meedstrom/org-node/blob/main/org-node.el][org-node.el]]. +For real-world usage, search for =el-job= in the source of [[https://github.com/meedstrom/org-node/blob/main/org-node.el][org-node.el]]. ** Design rationale I want to shorten the round-trip as much as possible, *between the start of an async task and having the results*. diff --git a/el-job.el b/el-job.el index a263911797..86aece5fb6 100644 --- a/el-job.el +++ b/el-job.el @@ -295,7 +295,7 @@ with one character of your choosing, such as a dot." id (cores-to-use 1) callback - (ready nil :documentation "Processes ready for input. Becomes nil permanently if METHOD is `reap'.") + (ready nil :documentation "Processes ready for input.") (busy nil :documentation "Processes that have not yet returned output.") stderr (timestamps (list :initial-job-creation (current-time))) @@ -599,10 +599,10 @@ If the job was idle, just reap the processes and print nothing." (message "el-job: Timed out, was busy for 30+ seconds: %s" desc) (el-job--dbg 2 "Reaped idle processes for %s" desc))))) -;; REVIEW: We use `process-send-string' to send a \n when sending more input (in -;; `el-job--exec'). +;; REVIEW: We use `process-send-string' to send a \n when sending more input +;; (in `el-job--exec'). ;; Can that cause a bug combined with this? -;; Could workaround by using a NUL byte: pass 0 instead of ?\n. +;; Could workaround by using a NUL byte: 0 instead of ?\n. ;; In el-job-child.el, it'll have to use `prin1' rather than `print.' ;; Or, we can just remove the change-hook until after we sent the ;; aforementioned \n. @@ -612,18 +612,14 @@ Can be called in a process buffer at any time." (if (eq (char-before) ?\n) (el-job--handle-output))) -;; TODO: remove arg -(defun el-job--handle-output (&optional dead-process) +(defun el-job--handle-output () "Handle output in current buffer. If this is the last output for the job, merge all outputs, maybe execute the callback function, finally maybe run the job again if there is now -more input in the queue. - -Argument DEAD-PROCESS, if provided, should be the corresponding process -object. If nil, infer it from the buffer, if process is still alive." +more input in the queue." (let* ((inhibit-quit t) - (proc (or dead-process (get-buffer-process (current-buffer)))) + (proc (get-buffer-process (current-buffer))) (job el-job-here) finish-time durations