An Emacs major mode for the SPy programming language.
- Syntax highlighting - Derives from
python-ts-mode(if available) orpython-mode - Compile-time/Runtime colorization - Visual distinction between blue (compile-time) and red (runtime) code
- Compiler pipeline inspection - View Python AST, SPy AST, imports, symbol tables, and more
- Execution & compilation - Run SPy code directly or compile to native executables
- Hydra menu - Quick access to all SPy commands via
C-c s(hydra-spy/body)
(use-package spy-mode
:ensure t
:vc (:fetcher github :repo aisipos/spy-mode.el)
:files ("*.el")
:custom
(spy-command "spy") ; or "uv run spy"
(spy-mode-reuse-output-buffer nil)) ; set to t to reuse a single output buffer- Clone or download this repository
- Add to your Emacs configuration:
(add-to-list 'load-path "/path/to/spy-mode")
(require 'spy-mode)Set the SPy compiler command (defaults to "spy"):
(setq spy-command "spy")
;; Or if using uv:
(setq spy-command "uv run spy")Optionally reuse a single output buffer for all commands:
(setq spy-mode-reuse-output-buffer t)Press C-c s in a SPy buffer to open the hydra menu with quick access to all commands:
All commands are also available via M-x:
spy-show-pyparsespy-show-parsespy-show-importsspy-show-symtablespy-show-redshiftspy-compile-executablespy-execute-bufferspy-redshift-execute-bufferspy-show-cwritespy-show-cdumpspy-colorize-buffer- With prefix arg (C-u), retains output bufferspy-colorize-clear-bufferspy-toggle-colorize-buffer
Use spy-colorize-buffer (or c in the hydra) to apply colorization based on spy colorize --format=json output.
- SPy compiler
- Optional: hydra for the command menu