;;; -*- lexical-binding: t -*- (require 'cl-lib) (cl-pushnew "." load-path :test #'string=) (require 'luki-lisp) (-> 'bad-ascii) (cl-defmethod bad-helper () (cl-loop with ext = "txt" with txt-dir = (file-name-concat "~" ext) with dir = (file-directory-p txt-dir) with files = (& dir (directory-files txt-dir 'full ext 'nosort)) with srted = (sort files (L (_ __) (z (random 2)))) while srted do (sleep-for (1+ (random 16))) (find-file (pop srted)) ($ "%s" (bad-buffer-string)))) (cl-defmethod bad-help () (let ((name "bad-helper") (buf "*bad-para-draw*")) (make-process :name name :buffer buf :command (string-split "emacs -Q -D -L . -batch -l bad -l bad-pa -f bad-helper") :noquery t :filter (L (_ msg) (with-current-buffer buf (@i msg)))))) (cl-defmethod bad-process-list () (let* ((ps (process-list)) (num (--- ps))) (cl-case num (0 ($ "No processes")) (1 (let* ((prc (1st ps)) (nme (process-name prc)) (sts (process-status prc))) ($ "one process: %s [%s]" nme sts) prc)) (t (& (yes-or-no-p (@f "show %s processes?" num)) (list-processes)))))) (defalias 'pl #'bad-process-list) (<- 'bad-pa)