branch: externals/el-job
commit b8b0e822a1473f1ce5d34b9ca05af464c04e2f6f
Author: Martin Edström <[email protected]>
Commit: Martin Edström <[email protected]>

    Expunge debug extensions to own file
---
 el-job-ng-debug.el | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 el-job-ng.el       | 55 ------------------------------------
 2 files changed, 82 insertions(+), 55 deletions(-)

diff --git a/el-job-ng-debug.el b/el-job-ng-debug.el
new file mode 100644
index 0000000000..2c20b135e9
--- /dev/null
+++ b/el-job-ng-debug.el
@@ -0,0 +1,82 @@
+;;; el-job-ng-debug.el --- Debug helpers for el-job-ng  -*- lexical-binding: 
t; -*-
+
+;; Copyright (C) 2026 Free Software Foundation, Inc.
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Debug tools.
+
+;;; Code:
+
+(require 'el-job-ng)
+
+;;;###autoload
+(defun el-job-ng-debug-kill-all ()
+  "Kill all jobs and forget all metadata."
+  (interactive)
+  (cl-loop for id being each hash-key of el-job-ng--jobs
+           do (el-job-ng-kill id))
+  (clrhash el-job-ng--jobs))
+
+;;;###autoload
+(defun el-job-ng-debug-cycle ()
+  "Cycle through values for `el-job-ng--debug-level'."
+  (interactive)
+  (message "Variable `el-job-ng--debug-level' set to %d"
+           (setq el-job-ng--debug-level (% (1+ el-job-ng--debug-level) 3))))
+
+(cl-defun el-job-ng-debug-run (&key id
+                                    inject-vars
+                                    require
+                                    eval
+                                    inputs
+                                    funcall-per-input
+                                    callback)
+  "Like `el-job-ng-run' but run in main process.
+This exists for comparison and debugging.
+
+Arguments are the same as `el-job-ng-run' \(ID, INJECT-VARS, REQUIRE,
+EVAL, INPUTS, FUNCALL-PER-INPUT, CALLBACK)."
+  (setq id (or id (abs (random))))
+  (let ((job (or (gethash id el-job-ng--jobs)
+                 (puthash id (el-job-ng--make-job :id id) el-job-ng--jobs))))
+    (el-job-ng--with job (.processes .outputs)
+      (dolist (proc .processes)
+        (delete-process proc))
+      (dolist (lib require)
+        (load (locate-library (symbol-name lib))))
+      (setf .outputs nil)
+      (let ((simple-child
+             (lambda ()
+               (dolist (form eval)
+                 (eval form t))
+               (let ((ctr 0))
+                 (while-let ((input (pop inputs)))
+                   (message "Running %s (%d)..." funcall-per-input (cl-incf 
ctr))
+                   (push (funcall funcall-per-input input inputs)
+                         .outputs))))))
+        (eval `(let ,(cl-loop for (var . val) in inject-vars
+                              if (listp val)
+                              collect `(,var ',val)
+                              else collect `(,var ,val))
+                 (funcall ,simple-child))
+              t)
+        (when callback
+          (funcall callback .outputs))))))
+
+(provide 'el-job-ng-debug)
+
+;;; el-job-ng-debug.el ends here
diff --git a/el-job-ng.el b/el-job-ng.el
index 1abe34461a..8cdadd1fda 100644
--- a/el-job-ng.el
+++ b/el-job-ng.el
@@ -460,61 +460,6 @@ Otherwise, a keyboard quit would let it continue in the 
background."
   (when-let* ((job (el-job-ng-job id)))
     (el-job-ng--job-processes job)))
 
-
-;;; Debug tools
-
-(defun el-job-ng-debug-kill-all ()
-  "Kill all jobs and forget all metadata."
-  (interactive)
-  (cl-loop for id being each hash-key of el-job-ng--jobs
-           do (el-job-ng-kill id))
-  (clrhash el-job-ng--jobs))
-
-(defun el-job-ng-cycle-debug ()
-  "Cycle through values for `el-job-ng--debug-level'."
-  (interactive)
-  (message "Variable `el-job-ng--debug-level' set to %d"
-           (setq el-job-ng--debug-level (% (1+ el-job-ng--debug-level) 3))))
-
-(cl-defun el-job-ng-run-sync (&key id
-                                   inject-vars
-                                   require
-                                   eval
-                                   inputs
-                                   funcall-per-input
-                                   callback)
-  "Like `el-job-ng-run' but synchronous.
-This exists for comparison and debugging.
-
-Arguments are the same as `el-job-ng-run' \(ID, INJECT-VARS, REQUIRE,
-EVAL, INPUTS, FUNCALL-PER-INPUT, CALLBACK)."
-  (setq id (or id (abs (random))))
-  (let ((job (or (gethash id el-job-ng--jobs)
-                 (puthash id (el-job-ng--make-job :id id) el-job-ng--jobs))))
-    (el-job-ng--with job (.processes .outputs)
-      (dolist (proc .processes)
-        (delete-process proc))
-      (dolist (lib require)
-        (load (locate-library (symbol-name lib))))
-      (setf .outputs nil)
-      (let ((simple-child
-             (lambda ()
-               (dolist (form eval)
-                 (eval form t))
-               (let ((ctr 0))
-                 (while-let ((input (pop inputs)))
-                   (message "Running %s (%d)..." funcall-per-input (cl-incf 
ctr))
-                   (push (funcall funcall-per-input input inputs)
-                         .outputs))))))
-        (eval `(let ,(cl-loop for (var . val) in inject-vars
-                              if (listp val)
-                              collect `(,var ',val)
-                              else collect `(,var ,val))
-                 (funcall ,simple-child))
-              t)
-        (when callback
-          (funcall callback .outputs))))))
-
 (define-obsolete-function-alias 'el-job-ng-job 'el-job-ng-get-job "2026-01-22")
 (defun el-job-ng-get-job (id-or-process)
   (if (processp id-or-process)

Reply via email to