7f3769fcd8
Add SPINE_ORG environment variable support to scripts/run. When set, the value is passed as spine-org-file via --eval before loading spine.el. Usage: SPINE_ORG=~/my-books.org ./scripts/run SPINE_ORG=/work/personal-local/spine/sample-books.org ./scripts/run localhost:9090 When unset, defaults to ~/spine/books.org (existing behavior).
1.5 KiB
1.5 KiB
Parameterize spine.org Path via Environment Variable
Problem
The org data file path (spine-org-file) is hardcoded to ~/spine/books.org in
spine.el. Users who want to point the app at a different org file must manually
construct the full emacs --eval command line instead of using the scripts/run
convenience script.
Design
Add SPINE_ORG environment variable support to scripts/run. When set, the
script passes the path to Emacs via --eval before loading spine.el, matching
the existing pattern for spine-host and spine-port.
Interface
# Default (same as today): ~/spine/books.org
./scripts/run
# Custom path, default port 8080
SPINE_ORG=~/my-books.org ./scripts/run
# Custom path with host and port
SPINE_ORG=$(pwd)/sample-books.org ./scripts/run localhost:9090
Affected files
scripts/run— add SPINE_ORG env var check before launching Emacsspine.el— no changes needed (already usesspine-org-filedefvar)- Tests — no changes needed (already set their own
spine-org-file)
Implementation
In scripts/run, after the HOST/PORT argument parsing block (line 18), add:
if [ -n "${SPINE_ORG:-}" ]; then
EMACS_ARGS+=(--eval "(setq spine-org-file \"$SPINE_ORG\")")
fi
Edge cases
SPINE_ORGunset or empty → ignored, default inspine.elapplies- Path with spaces → quoted inside the Emacs string, handled correctly
- Relative vs absolute paths → user's responsibility; Emacs resolves relative to default-directory