aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.org19
-rw-r--r--example/Makefile9
-rw-r--r--example/example.lua22
-rw-r--r--norns_upload2
4 files changed, 51 insertions, 1 deletions
diff --git a/README.org b/README.org
index 19f8786..636640a 100644
--- a/README.org
+++ b/README.org
@@ -2,7 +2,7 @@
Get a lua shell or supercollider shell on a norns from the command-line, similar to the shell in the maiden interface.
-Requires nanomsg.
+Requires nanomsg. Install with ~sudo make install~.
#+BEGIN_SRC sh
# get a lua shell
@@ -12,3 +12,20 @@ Requires nanomsg.
./norns_shell ws://norns.local:5556
#+END_SRC
+There's an example in ~example/~ of a project with a Makefile that uploads and loads when ~M-x compile~'d in emacs. This piece of emacs lisp may be helpful if you'd like to ~C-c C-c~ instead.
+
+#+BEGIN_SRC lisp
+(defun recursive-upwards-compile ()
+ (interactive)
+ (if (string-prefix-p "make" compile-command)
+ (let ((directory (locate-dominating-file default-directory "Makefile")))
+ (when directory
+ (cd directory)
+ (compile compile-command)
+ (message directory)))
+ (compile compile-command)))
+
+(add-hook 'lua-mode-hook
+ (lambda ()
+ (local-set-key (kbd "C-c C-c") 'recursive-upwards-compile)))
+#+END_SRC
diff --git a/example/Makefile b/example/Makefile
new file mode 100644
index 0000000..bbaebf9
--- /dev/null
+++ b/example/Makefile
@@ -0,0 +1,9 @@
+NORNS=norns.local
+
+all:
+
+upload: example.lua
+ find . -not -path '*/\.*' -type f -exec norns_upload example "{}" \;
+ norns_load example example.lua
+
+.PHONY: all upload
diff --git a/example/example.lua b/example/example.lua
new file mode 100644
index 0000000..e96ba34
--- /dev/null
+++ b/example/example.lua
@@ -0,0 +1,22 @@
+-- An example script for norns-etc
+-- Load this file in emacs and M-x compile to upload.
+
+function redraw()
+ screen.clear()
+ screen.move(64, 32)
+ screen.text_center("norns example #" .. math.floor(math.random() * 1000))
+ screen.update()
+end
+
+
+function init()
+ redraw()
+end
+
+-- This needs to be at the end so that it doesn't conflict with the
+-- norns convention of having a script description in comments on the
+-- first couple of lines.
+
+-- Local Variables:
+-- compile-command: "make upload"
+-- End:
diff --git a/norns_upload b/norns_upload
index dd4dba6..37817ea 100644
--- a/norns_upload
+++ b/norns_upload
@@ -5,6 +5,8 @@ if [[ $# -ne 2 ]]; then
exit 1
fi
+# TODO: make directories
+
HOST="${NORNS:-norns.local}"
API="/api/v1"
BASE="/dust/code/"