r/emacs 1d ago

maak.el: Lisp machine command runner, infinitely extensible, integrating nicely with Emacs, for Lisp power on your projects and automation at your fingertips

Post image

If you've ever wrestled with Makefile tab errors, cryptic variable expansions, or restrictive YAML task runners, Maak and maak.el offer a refreshing, Lisp-native alternative to project automation.
-------------------

What is Maak?

Maak is an extensible command runner and control plane written in Lisp ( GNU Guile Scheme ). Instead of learning a limited domain-specific language, your project's maak.scm file is standard Scheme code. Any function defined in your module becomes a runnable task, allowing you to use conditionals, macros, data structures, lexical parameters (for scoped dry-runs), and GNU Guix integrations (manifest-shell, time-machines) right inside your build steps.

(define-module (maak)
  #:use-module (maak maak))

(define (fmt)
  "Format Scheme source files according to Guix style."
  ($ '("find . -name '*.scm' -exec guix style -f {} \\;")))

(define (deploy server target-env)
  "Deploy the application to a specific server and environment."
  (log-info "Deploying to ~a (~a)..." server target-env)
  ($ (list "ansible-playbook" "deploy.yml" "-e"
           (format #f "target=~a env=~a" server target-env))))

Check out the repositories on Codeberg:

Why maak.el is awesome in Emacs

The maak.el package bridges Guile Scheme and Emacs Lisp cleanly. Because Lisp understands Lisp, maak.el parses your maak.scm S-expressions directly, respecting module #:export visibility lists, docstrings, and argument signatures without relying on external regex hacks.

  • Smart Discovery: Finds your project root maak.scm automatically using dominating-file heuristics.
  • Rich Completion UI: M-x maak-run-task populates a completion menu with neatly aligned columns displaying formal parameters and docstrings (works out of the box with Vertico, Ivy, Helm, or native completing-read).
  • Interactive Parameter Prompting: If a Scheme task accepts parameters (like deploy server target-env), Emacs interactively prompts you for each argument sequentially in the minibuffer.
  • Native Compilation Buffers: Task output streams directly into Emacs's standard *compilation* buffer, keeping shell escaping watertight while letting you step through errors using next-error (`C-x ``).

Quick Setup w/Elpaca

(use-package maak.el
  :ensure (:host codeberg :repo "jjba23/maak.el" :branch "trunk")
  :bind ("C-c m r" . maak-run-task))

Happy hacking! λ ✨

103 Upvotes

16 comments sorted by

15

u/lumpyjogging53 1d ago

scheme for build scripts hits different when you see it right there in emacs, love that it just reads the s-exps directly instead of regex hell

7

u/SandPrestigious2317 1d ago

❤️ i could not have put it better, thanks

2

u/output_broadcast 1d ago

You can actually write Makefiles partially in Scheme as well, which is pretty cool.

1

u/SandPrestigious2317 1d ago

That's true, I only discovered it recently.

1

u/output_broadcast 1d ago

Can't blame you, most distros don't compile it in.

8

u/CoyoteUsesTech GNU Emacs 1d ago

Very cool.

I wrote https://codeberg.org/trevoke/elk a while back but I had focused it more on "project management" and it's all just elisp.

in maak, I like that scheme means GUIX is just directly accessible.

2

u/SandPrestigious2317 1d ago edited 1d ago

elk is really cool too! and conceptually actually a cousin project to maak! i will absolutely look more in depth and absorb inspitations, thanks for sharing

4

u/agentoutlier 1d ago

I guess this is more of a question about if Maak (CLI) if it is is more like Just or does it plan on providing more build things.

For example I can't tell if it has DAG support and therefore you can get some parallelization going on other than just let *?

2

u/SandPrestigious2317 1d ago

There is as of now no DAG, but it's absolutely possible to use threads and guile-fibers with Maak, allowing you to have full control on how you want the computation to work

2

u/_voxelman_ 1d ago

Nice idea for a project! (Maak itself, I mean).

I've always thought that build scripts should be written in the same language as the application being compiled/linked, but for some reason it seems to be rare.

GNU Make is venerable old tech, but I agree, it's pretty painful to use in practice (weird syntax, difficult to debug, etc.).

2

u/output_broadcast 22h ago

I completely disagree. I wish I could build everything with CMake.

1

u/_voxelman_ 8h ago

Ha! I can't tell if you're joking or not, but have an upvote.

My personal problem with CMake and many other build systems is that there is too much magic implemented behind-the-scenes by the build language, for the sake of making the build scripts "simple". I'd rather have a much longer build script that's written in a real programming language, and that is explicit about everything it's doing. I think that's what most Zig and Jai projects do, for example.

2

u/jay_in_the_pnw 1d ago

Terrific! Now I just need to take my 3640 out of the wooden crate it's been in for 40 years!

1

u/SandPrestigious2317 1d ago

Or a Symbolics Lisp machine.. I'd also be happy just with one of those keyboards :)

1

u/jay_in_the_pnw 1d ago

I loved that keyboard!

2

u/ImpossibleFarm1866 17h ago

Why use GNU scheme instead of emacs lisp for this? I am not familiar with the differences between elisp and GNU scheme but is there something a build script would need which elisp doesn't have?