From 29744f4ade9e94f55d6deb4de72498ee537f87b1 Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Mon, 9 Dec 2019 09:21:21 -0500 Subject: nodemcu tweaks --- emacs/inits/20-programming.el | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'emacs/inits/20-programming.el') diff --git a/emacs/inits/20-programming.el b/emacs/inits/20-programming.el index c75d2c3..5bf5cb5 100644 --- a/emacs/inits/20-programming.el +++ b/emacs/inits/20-programming.el @@ -1,4 +1,4 @@ -;; Time-stamp: <2019-11-09 11:36:50 (tslil@basingstoke)> +;; Time-stamp: <2019-12-08 23:27:56 (tslil@bison)> ;; ----------------------------------------------------------------------------- ;; General setup @@ -79,7 +79,20 @@ :config (setq nodemcu-default-keybindings t nodemcu-port "/dev/ttyUSB0" - nodemcu-backend "nodemcu-uploader")) + nodemcu-backend "nodemcu-uploader") + + (defun nodemcu-better-upload-current-file (&optional noreset) + (interactive "P") + (let ((proc (get-process "nodemcu-terminal"))) + (when proc + (delete-process proc)) + (shell-command + (nodemcu--get-command "upload" (file-name-nondirectory (buffer-file-name)))) + (unless noreset + (shell-command + (nodemcu--get-command "node restart")) + (when proc + (nodemcu-terminal))))) (use-package lua-mode :after nodemcu-mode @@ -89,12 +102,14 @@ ("C-x C-e" . lua-send-current-line) ("C-c C-d" . lua-send-defun) ("C-c C-e" . lua-send-region) + ("C-c C-u" . nodemcu-better-upload-current-file) + ("C-c C-t" . nodemcu-terminal) ("M-n" . lua-forward-sexp) ("M-p" . lua-backwards-to-block-begin-or-end)) :hook (lua-mode . (lambda () (require 'nodemcu-mode) (use-package company-lua :ensure t :demand) - (nodemcu-mode) + (nodemcu-mode 1) (add-to-list 'company-backends 'company-lua)))) ;; What are these? -- cgit v1.2.3