A major mode for editing Ren’Py files.
Either install the renpy-mode package from within Emacs directly from MELPA or:
- Download/clone this repo to your desired location.
- In Emacs, use the
package-install-filecommand and point it to the renpy-mode.el file location.
- Movement, indentation and syntax highlighting for Ren’py and embedded Python.
- Outline Minor Mode support for an overview of block-defining statements.
- In-buffer navigation with Imenu.
- Context-sensitive symbol completion.
- Jumping to symbol definitions with Xref.
- Compiling, running, linting from within Emacs.
- Running renpy CLI subcommands.
- Error highlighting with Flymake.
Example configuration with the use-package macro:
(use-package renpy-mode
;; Install the package unless installed already.
:ensure t
;; Uncomment and tweak if renpy-mode was downloaded into a custom.
;; location.
;; :load-path "path/to/renpy/dir"
:custom
;; Path to the Ren'Py launcher or renpy.sh / renpy.exe.
(renpy-program "path/to/renpy")
:bind
;; Bind some useful commands.
("C-c C-c" . renpy-compile)
("C-c C-r" . renpy-run)
("C-c C-l" . renpy-lint)
:hook
;; Enable on-the-fly linting and code overview.
((renpy-mode . flymake-mode)
(renpy-mode . outline-minor-mode))) ; code overviewOnce configured, try within a renpy-mode buffer:
M-x renpy-run- launch the project.M-x renpy-lint- run lint with compilation-mode.M-x renpy-compile- run compile with compilation-mode.C-c <- shift lines left.C-c >- shift lines right.TAB- cycle through possible indentation levels.C-c C-n- next statement.C-c C-p- previous statement.C-c C-u- beginning of black.C-c C-k- mark block.C-c C-jshow Imenu.M-.jump to definition.
The package comes with the emacs.edit.py script that configures Ren’py
integration with Emacs. Having the RENPY_EDIT_PY environment variable set to the
path of the file would force Ren’py launcher to use Emacs as a default editor.
See https://www.renpy.org/doc/html/editor.html for details.
renpy-mode’s completion and definition mechanisms currently search symbols
across all open buffers belonging to a Ren’Py project defined by a top-level
game/ directory. As per-buffer symbol lists are cached the lookup is fast even
for relatively big projects.
The following symbol definitions are recognised and used for both completion and jump-to-definition mechanisms:
- labels
- images
- transforms
- screens
Unlike most Emacs modes not based on LSP, renpy-mode tries to be as precise as
possible when building a list of completions/definitions by parsing local
context.
The mode is based on Leo Liu’s fork of the original Emacs’s Python mode (python.el) by Dave Love.
In its Ren’py incarnation the mode was imported to Github in 2015 by Quil (@robotlolita), then taken over by Trey Merkley (@treymerkley), followed by Reagan Middlebrook (@reagankm). A major refresh of the code was made by Morgan Willcock (@morganwillcock) in 2023, followed by features added by Vladimir Kazanov in 2025.
Come at me, parentheses. I dare you.