dot-emacs

My emacs dotfiles/config
git clone git://git.ethandl.dev/dot-emacs
Log | Files | Refs

commit bb88776b0806b3b22c46b7c1ef3074187e972b8d
parent c96358c02c46cba428de2502235e36ae3c09eb91
Author: Ethan Long <ethandavidlong@gmail.com>
Date:   Sat, 20 Jun 2026 02:52:55 +1000

Simplified the overly-complicated perf improvement

This is still too complicated for some people I would imagine, but at
least I'm not using thunks for delayed evaluation. I'm far too brain
rotten by Haskell for my own good.

Diffstat:
Mconfig.org | 52+++++++++++++++++++++++++---------------------------
1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/config.org b/config.org @@ -365,35 +365,33 @@ For debugging purposes, you can disable the tangling of this block: ** Asyncronous commands The package ~async~ allows for us to run long, blocking commands in separate Emacs processes. #+begin_src emacs-lisp - (setq ethandl/async-fn-queue nil) - (setq ethandl/lazy-async-fn-queue nil) - (setq ethandl/async-fn-evaluated nil) - - (defun ethandl/eval-async-fn-queue () - ;; Evaluate regular async fns - (push (mapcar #'async-start ethandl/async-fn-queue) - ethandl/async-fn-evaluated) - (setq ethandl/async-fn-queue nil) - - ;; Generate lazy async fns and evaluate - (let ((fns (mapcar #'funcall ethandl/lazy-async-fn-queue))) - (push (mapcar #'async-start fns) - ethandl/async-fn-evaluated)) - (setq ethandl/lazy-async-fn-queue nil)) - - (defun ethandl/async-fn-queue-add (form &optional inject-vars) - (if inject-vars - (push (lambda () - `(lambda () - ,(async-inject-variables inject-vars) - ,form)) - ethandl/lazy-async-fn-queue) - (push `(lambda () ,form) ethandl/async-fn-queue))) + (defvar ethandl/async-job-queue nil) + (defvar ethandl/async-job-results nil) + + (defun ethandl/eval-async-job (job) + (let ((form (car job)) + (inject-vars (cadr job))) + (async-start + (if inject-vars + `(lambda () + ,(async-inject-variables inject-vars) + ,form) + `(lambda () ,form)) + (lambda (result) + (push result ethandl/async-job-results))))) + + + (defun ethandl/eval-async-job-queue () + (mapc #'ethandl/eval-async-job ethandl/async-job-queue) + (setq ethandl/async-job-queue nil)) + + (defun ethandl/async-job-queue-add (form &optional inject-vars) + (push (list form inject-vars) ethandl/async-job-queue)) (elpaca async (require 'async) - (ethandl/eval-async-fn-queue) - (run-with-idle-timer 30 t 'ethandl/eval-async-fn-queue)) + (ethandl/eval-async-job-queue) + (run-with-idle-timer 30 t 'ethandl/eval-async-job-queue)) #+end_src ** Ahead-of-time nativecomp After just installing this Emacs config, things can be a little stuttery. We can speed this up by telling Emacs to nativecomp everything. @@ -493,7 +491,7 @@ Treesitter grammar installation is slow and blocks up the emacs process. The fol #+begin_src emacs-lisp (defun ethandl/treesit-install-async (lang) (unless (treesit-language-available-p lang) - (ethandl/async-fn-queue-add + (ethandl/async-job-queue-add `(treesit-install-language-grammar ',lang) "\\`treesit-language-source-alist\\'"))) #+end_src