Only working code will be committed to MELPA Stable, but the current functionality is limited
This package provides a minor mode called circuitpython-mode
.
This mode is intended to help with the workflow in circuitpython
development. It is invoked by typing:
M-x circuitpython-mode
A function, circuitpython-compile-copy
, is added that is invoked each
time the buffer is saved (after-save-hook). When invoked, the new
command will update the compile-command
to be a shell command that will copy the current file to
a different directory (ie the board). The destination directory needs
to be defined as a file-local or dir-local variable. After each
file save (**[C-x C-s]**, **[C-x w]**, etc), the default
compile-command will be something like:
cp filename.py /some/path/some/where/
This does not modify the behavior of compile
itself, it only changes the
command that will presented as the default compile command when
invoking compile
(usually **[C-c c]** )
Additionally, a new command, circuitpython-mpy-compile
, is added and
bound to **[C-c !]**. If the variable mpy-compiler
is defined (ie as
file-local or dir-local), then that command will be used. Otherwise
the command “mpy-cross” is used. One potentional reason to specify
the mpy-compiler is if it is not in $PATH. This will define the
compile-command to be something like:
mpy-cross filename.py
There is also a command, circuitpython-set-mpy-compiler
, bound to
**[C-c @]** that allows the user to override the process described
above and provide an alternative command.
After the mpy compile command is defined, compile
is called, after which
circuitpython-compile-copy
(see above) is called. This means that
after compiling an .mpy, the compile command will revert back to being
the command to copy the file to the board.
.dir-locals.el
((nil . ((circuitpython-copy-path . "/mnt/chromeos/removable/CIRCPY/"))))