emacs command line demo
borkdude@MBP25-3 ~ $ time emacs --batch -L ~/dev/cljbang -l cljbang --eval '(cljbang-eval-string "(prn :hello)")'
:hello
emacs --batch -L ~/dev/cljbang -l cljbang --eval 0,03s user 0,01s system 72% cpu 0,063 total
avg shared (code): 0 KB
avg unshared (data/stack): 0 KB
total (sum): 0 KB
max memory: 31136 MB
page faults from disk: 15
other page faults: 3818
borkdude@MBP25-3 ~ $ bat /tmp/hello.clj
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: /tmp/hello.clj
│ Size: 405 B
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ (ns hello
2 │ (:require [cljbang.core :refer [el!]]
3 │ [clojure.string :as str]))
4 │
5 │ (defn args []
6 │ (let [a (el! command-line-args-left)]
7 │ (if (= "--" (first a)) (rest a) a)))
8 │
9 │ (defn main [& names]
10 │ (let [names (if (seq names) names ["world"])]
11 │ (println (str "hello, " (str/join ", " names) "!"))
12 │ (println "emacs" (el! (nth 2 (split-string (emacs-version) " "))))))
13 │
14 │ (apply main (args))
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
borkdude@MBP25-3 ~ $ time emacs --batch -L ~/dev/cljbang -l cljbang --eval '(cljbang-load-file "/tmp/hello.clj")' 1 2 3
hello, 1, 2, 3!
emacs 30.2
emacs --batch -L ~/dev/cljbang -l cljbang --eval 1 2 3 0,03s user 0,01s system 72% cpu 0,064 total
avg shared (code): 0 KB
avg unshared (data/stack): 0 KB
total (sum): 0 KB
max memory: 31664 MB
page faults from disk: 15
other page faults: 3841