diff --git a/sonic-pi-mode.el b/sonic-pi-mode.el index ab4a68e..8add7dd 100644 --- a/sonic-pi-mode.el +++ b/sonic-pi-mode.el @@ -22,6 +22,7 @@ (define-key map (kbd "C-c M-c") 'sonic-pi-connect) (define-key map (kbd "C-c C-k") 'sonic-pi-send-buffer) (define-key map (kbd "C-c C-r") 'sonic-pi-send-region) + (define-key map (kbd "C-c C-w") 'sonic-pi-send-line) (define-key map (kbd "C-c C-q") 'sonic-pi-quit) (define-key map (kbd "C-c C-b") 'sonic-pi-stop-all) (define-key map (kbd "C-c C-c") 'sonic-pi-send-live-loop) diff --git a/sonic-pi-osc.el b/sonic-pi-osc.el index a54a770..6398e8a 100644 --- a/sonic-pi-osc.el +++ b/sonic-pi-osc.el @@ -72,6 +72,13 @@ (hlt-highlight-regexp-region (region-beginning) (region-end) ".+" 'eval-sonic-pi-flash nil) (run-at-time flash-time nil 'hlt-unhighlight-region nil nil nil)) +(defun sonic-pi-send-line () + "send a line to sonic via osc" + (interactive) + (sonic-pi-osc-send-text (line-beginning-position) (line-end-position)) + (hlt-highlight-regexp-region (line-beginning-position) (line-end-position) ".+" 'eval-sonic-pi-flash nil) + (run-at-time flash-time nil 'hlt-unhighlight-region nil nil nil)) + (defun sonic-pi-send-buffer () "send the current buffer to sonic via osc" (interactive) @@ -95,7 +102,7 @@ "send a live-loop to sonic via osc" (interactive) (save-excursion - (let ((s (re-search-backward "^\\(live_loop\\|with_fx\\)"))) + (let ((s (re-search-backward "^\\(live_loop\\|with_fx\\|in_thread\\|define\\)"))) (ruby-end-of-block) (end-of-line) (sonic-pi-osc-send-text s (point))