From 071afd1860dfdd4f2d3b697faa21de47b0631ac3 Mon Sep 17 00:00:00 2001 From: xengineering Date: Fri, 17 Apr 2026 08:45:03 +0200 Subject: posix-shell: utils: Add automeson() This function allows to run `meson compile -C ` always for a given build directory whenever an also given file is written. This is especially useful to edit LaTeX files and let them update automatically on each save of the editor with automeson, meson and latexmk. The performance is so good that it speeds up the LaTeX and especially TikZ development significantly. --- posix-shell/utils.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'posix-shell') diff --git a/posix-shell/utils.sh b/posix-shell/utils.sh index b21c09b..0d71901 100644 --- a/posix-shell/utils.sh +++ b/posix-shell/utils.sh @@ -276,3 +276,26 @@ hexdiff() { rm -f "$dump1" "$dump2" } + +automeson() { + if test "$#" -ne 2 + then + echo "Usage: automeson " + return 1 + fi + + build="$1" + file="$2" + + while true + do + inotifywait --quiet --event close_write "$file" + clear + if meson compile -C "$build" + then + printf '\033[32mOK\033[0m\n' + else + printf '\033[31mFAILED\033[0m\n' + fi + done +} -- cgit v1.3.1