- put
foxdot-cli.py
in the same directory as the FoxDot installaton (in case you're usingvirtualenv
, otherwise comment from lines 5 to 7) - copy
foxdot-mode.el
to~/.emacs.d/lisp
- add
(defvar foxdot-cli-path "/path/to/foxdot-cli/")
in your~/.emacs
file - in Emacs
M-x load-library
and complete withfoxdot-mode
- Type
C-c C-f
orM-x foxdot-start
to start - Type
C-c C-e
orM-x foxdot-execute
to evaluate a line or a block of code
-
-
Save lvm/c84e4d5ca54f1db256eaa6c98db5b141 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python | |
import os | |
import cmd | |
BASE_PATH = os.path.dirname(os.path.abspath(__file__)) | |
ACTIVATE_PY = os.path.join(BASE_PATH, ".env", "bin", "activate_this.py") | |
execfile(ACTIVATE_PY, dict(__file__=ACTIVATE_PY)) | |
from FoxDot import * | |
class FoxDotConsole(cmd.Cmd): | |
prompt = "FoxDot> " | |
intro = "LiveCoding with Python and SuperCollider" | |
def default(self, line): | |
execute(line) | |
if __name__ == "__main__": | |
FoxDotConsole().cmdloop() |
(defvar foxdot-buffer-name "*FoxDot*") | |
(defun foxdot-start () | |
(interactive) | |
(progn | |
(setq | |
python-shell-interpreter-args (concat foxdot-cli-path "foxdot-cli.py") | |
fd-code-buffer (format (buffer-name)) | |
) | |
(run-python (python-shell-parse-command)) | |
(python-shell-switch-to-shell) | |
(rename-buffer foxdot-buffer-name) | |
(switch-to-buffer-other-window fd-code-buffer) | |
)) | |
(defun foxdot-execute(start end) | |
(interactive "r") | |
(progn | |
(setq | |
fd-code (buffer-substring-no-properties start end) | |
fd-code-buffer (format (buffer-name)) | |
) | |
(append-to-buffer (get-buffer foxdot-buffer-name) start end) | |
(switch-to-buffer-other-window (get-buffer foxdot-buffer-name)) | |
(execute-kbd-macro "\C-m") | |
(switch-to-buffer-other-window fd-code-buffer) | |
(execute-kbd-macro "\C-g") | |
)) | |
(global-set-key [?\C-c ?\C-e] `foxdot-execute) | |
(global-set-key [?\C-c ?\C-f] `foxdot-start) | |
(provide 'foxdot-mode) |
@lvm Foxdot does not provide emacs mode (the Foxdot page refers to this link), it is a shame that this modei does not work, it may not be too bad to repair.
@jargenty I'm pretty sure that you can use the "new" --pipe
flag in FoxDot to interpret code from STDIN.
Can't say for sure this works bc i do not have FD installed right now, but i'd try replacing line 7 of foxdot-mode.el
< python-shell-interpreter-args (concat foxdot-cli-path "foxdot-cli.py")
> python-shell-interpreter-args (concat foxdot-cli-path "python3 -m FoxDot -p -d our-samples-dir")
so instead of piping the selected code to foxdot-cli.py, it goes directly to FoxDot.
Another nice change could be to store "our samples dir" in a variable in ~/.emacs
but that's homework :-)
I am using FoxDot 0.8.8 installed via pip install. Launch procedure:
sclang
in a terminal then
sc3> FoxDot.start
then in another terminall
python -m FoxDot
@lvm, thank you but
What you offer does not work!
@jargenty never said it was going to. i suggested a path that you could follow in order to obtain a solution :-)
@rdtor @fdragovic keep in mind this was done many years ago. I'm not really sure this still works. And probably FoxDot provides a proper emacs mode.