[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/arduino-mode 0150970 050/107: support org-mode babel Ardui
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/arduino-mode 0150970 050/107: support org-mode babel Arduino src block |
Date: |
Sun, 29 Aug 2021 10:58:15 -0400 (EDT) |
branch: elpa/arduino-mode
commit 0150970da7b31a97aeec30aa0ae19cc6d298d012
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
support org-mode babel Arduino src block
---
ob-arduino.el | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/ob-arduino.el b/ob-arduino.el
new file mode 100644
index 0000000..f15b6f4
--- /dev/null
+++ b/ob-arduino.el
@@ -0,0 +1,67 @@
+;;; ob-arduino.el --- Org-mode Babel support for Arduino.
+
+;;; Commentary:
+
+
+
+;;; Code:
+
+(require 'org)
+(require 'ob)
+
+(defgroup ob-arduino nil
+ "org-mode blocks for Arduino."
+ :group 'org)
+
+(defcustom ob-arduino:program "arduino"
+ "Default Arduino program name."
+ :group 'ob-arduino
+ :type 'string)
+
+(defcustom ob-arduino:port "/dev/ttyACM0"
+ "Default Arduino port."
+ :group 'ob-arduino
+ :type 'string)
+
+;;;###autoload
+(defun org-babel-execute:arduino (body params)
+ "org-babel arduino hook."
+ (let* ((port (cdr (assoc :port params)))
+ (cmd (mapconcat 'identity (list
+ ob-arduino:program "--upload"
+ (if port (concat "--port " port))) " "))
+ (code (org-babel-expand-body:generic body params))
+ (src-file (org-babel-temp-file "ob-arduino-" ".ino")))
+ ;; delete all `ob-arduino' temp files, otherwise arduino will compile all
+ ;; ob-arduino temp files, and report error.
+ (mapc
+ (lambda (f)
+ (unless (file-directory-p f)
+ (delete-file (expand-file-name f org-babel-temporary-directory))))
+ (directory-files
+ (file-name-directory (org-babel-temp-file "ob-arduino-" ".ino"))
+ nil ".ino"))
+ ;; specify file for arduino command.
+ (with-temp-file src-file
+ (insert code))
+ (org-babel-eval
+ (concat ob-arduino:program
+ " " "--upload"
+ " " (if port (concat "--port " port))
+ " " src-file)
+ "" ; pass empty string "" as `BODY' to
`org-babel--shell-command-on-region'
+ ;; to fix command `arduino' don't accept string issue.
+ )
+ ))
+
+
+;;;###autoload
+(eval-after-load "org"
+ '(add-to-list 'org-src-lang-modes '("arduino" . arduino)))
+
+
+
+
+(provide 'ob-arduino)
+
+;;; ob-arduino.el ends here
- [nongnu] elpa/arduino-mode a468e63 035/107: Add basic support for file variables, (continued)
- [nongnu] elpa/arduino-mode a468e63 035/107: Add basic support for file variables, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode d1233b1 036/107: Use configured preferences file for ede signature, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 9a168aa 038/107: fix void function `ede-project-autoload`, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 1424952 039/107: add new keywords, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 411815d 041/107: change arduino-upload keybinding to [C-c C-c], ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 20e284a 042/107: format code, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 59806cc 043/107: add .ino file extension to auto-mode-alist, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode a95ebba 044/107: remove XEmacs support part, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 3d8aa47 045/107: improve and add some commands for command-line arduino., ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 3fc0851 046/107: use define-derived-mode for arduino-mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 0150970 050/107: support org-mode babel Arduino src block,
ELPA Syncer <=
- [nongnu] elpa/arduino-mode 139b154 051/107: add support for --board option with header argument :boarder, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 3f0b3a4 057/107: rename command arduino-build -> arduino-verify, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 7b94f5b 058/107: creating process with make-process to use process sentinel to get notification., ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 714e0f0 059/107: add missing menu entries, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 6b549c8 064/107: add a command to add include-path file for irony, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 8235a4a 065/107: fix mode-line-process not disappear after process failed, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 431c3ba 069/107: Merge branch 'develop', ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 9b1bdb8 060/107: support show process info in mode-line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 1f154e4 063/107: add a command to create new Arduino sketch, ELPA Syncer, 2021/08/29
- [nongnu] elpa/arduino-mode 8e82926 072/107: Use arduino-executable in commands instead, ELPA Syncer, 2021/08/29