Files
spine/docs/specs/2026-06-24-org-file-env-var-design.md
T
jbrechtel 7f3769fcd8 feat: add SPINE_ORG env var to override org file path
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).
2026-06-23 22:19:51 -04:00

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 Emacs
  • spine.el — no changes needed (already uses spine-org-file defvar)
  • 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_ORG unset or empty → ignored, default in spine.el applies
  • Path with spaces → quoted inside the Emacs string, handled correctly
  • Relative vs absolute paths → user's responsibility; Emacs resolves relative to default-directory