melpa compatability
This commit is contained in:
parent
d57c0c18fe
commit
096903f07e
4 changed files with 80 additions and 28 deletions
42
.github/workflows/test.yml
vendored
Normal file
42
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
emacs_version:
|
||||||
|
- 27.2
|
||||||
|
- 26.3
|
||||||
|
- 25.3
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Emacs
|
||||||
|
uses: purcell/setup-emacs@master
|
||||||
|
with:
|
||||||
|
version: ${{matrix.emacs_version}}
|
||||||
|
|
||||||
|
- name: Install Eldev
|
||||||
|
run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh
|
||||||
|
|
||||||
|
- name: Check out the elisp source code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Test the uncompiled source
|
||||||
|
run: |
|
||||||
|
cd el
|
||||||
|
eldev -p -dtT test
|
||||||
|
|
||||||
|
- name: Compile and run tests again
|
||||||
|
run: |
|
||||||
|
cd el
|
||||||
|
eldev compile
|
||||||
|
eldev -p -dtT test
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
*~
|
*~
|
||||||
|
*.elc
|
||||||
|
|
15
README.org
15
README.org
|
@ -3,10 +3,21 @@
|
||||||
#+STARTUP: showstars
|
#+STARTUP: showstars
|
||||||
|
|
||||||
** Why do I even?
|
** Why do I even?
|
||||||
[[https://orgmode.org/][Org-mode]] makes [[http://literateprogramming.com/][literate programming]] easy via [[https://orgmode.org/worg/library-of-babel.html][Library of Babel]]. Il simply allows to mix text with executable /code blocks/ (which can also be extracted (/tangled/) into separate, executable files. The beauty of the Library of Babel implementation in org-mode lies in the fact that it supports many languages. I craved support for [[https://github.com/supercollider/supercollider][SuperCollider]] and craving became an itch when I needed to document a working pipeline alternating between executing sclang and shell scripts. I scratched an itch with this little module.
|
[[https://orgmode.org/][Org-mode]] makes [[http://literateprogramming.com/][literate programming]] easy via [[https://orgmode.org/worg/library-of-babel.html][Library of Babel]]. Il simply allows to mix text with executable /code blocks/ which can also be extracted (/tangled/) into separate, executable files. The beauty of the Library of Babel implementation in org-mode lies in the fact that it supports many languages. I craved support for [[https://github.com/supercollider/supercollider][SuperCollider]] and craving became an itch when I needed to document a working pipeline alternating between executing sclang and shell scripts. I scratched an itch with this little module.
|
||||||
|
|
||||||
** How to install?
|
** How to install?
|
||||||
First of all, you will need emacs (>=25) and SuperCollider (with emacs support) installed. Modern emacsen and Spacemacs come with bundled org-mode. At this point I am the sole user of this plugin and have just written it so I am not itching yet for MELPA or inclusion in the official org-mode repositories, so installation is manual. You can either drop [[file:ob-sclang.el]] somewhere in your Emacs' path or add its containing directory to ~load-path~ in =.init= file:
|
First of all, you will need emacs (>=26) and SuperCollider (with emacs support) installed. Modern emacsen and Spacemacs come with bundled org-mode.
|
||||||
|
|
||||||
|
It can be installed as a package via [[https://melpa.org/#/i-ching][Melpa]] or manually.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package ob-sclang
|
||||||
|
:config (org-babel-do-load-languages
|
||||||
|
'org-babel-load-languages
|
||||||
|
'((sclang . t))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
To install manually you can either drop [[file:ob-sclang.el]] somewhere in your Emacs' path or add its containing directory to ~load-path~ in =.init= file:
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
(add-to-list 'load-path "/path/to/ob-sclang/")
|
(add-to-list 'load-path "/path/to/ob-sclang/")
|
||||||
|
|
48
ob-sclang.el
48
ob-sclang.el
|
@ -1,11 +1,12 @@
|
||||||
;;; ob-sclang.el --- org-babel functions for sclang evaluation
|
;;; ob-sclang.el --- Org-babel interface for SuperCollider -*- coding: utf-8;
|
||||||
|
|
||||||
;; Copyright (C) 2018 Michal Seta
|
;; Copyright (C) 2018 Michal Seta
|
||||||
|
|
||||||
;; Author: Michal Seta
|
;; Author: Michal Seta
|
||||||
;; Keywords: supercollider, literate programming, reproducible research
|
;; Keywords: supercollider, literate programming, multimedia, languages, tools
|
||||||
;; Homepage: https://github.com/djiamnot/ob-sclang.git
|
;; URL: https://github.com/djiamnot/ob-sclang
|
||||||
;; Version: 0.02
|
;; Package-Requires: ((emacs "26.1") (sclang "1.0"))
|
||||||
|
;; Version: 0.3
|
||||||
|
|
||||||
;;; License:
|
;;; License:
|
||||||
|
|
||||||
|
@ -24,21 +25,21 @@
|
||||||
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
;; Boston, MA 02110-1301, USA.
|
;; Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
;;; Requirements:
|
;;; Commentary:
|
||||||
;;; sclang requires SuperCollider, of course. You need to have both the SuperCollider
|
;; ob-sclang enables SuperCollider source blocks to be used in org files
|
||||||
;;; system installed and the sclang-mode
|
|
||||||
;;; SuperCollider can be found at https://github.com/supercollider/supercollider
|
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'ob)
|
(require 'ob)
|
||||||
(require 'sclang)
|
(require 'sclang)
|
||||||
|
|
||||||
;; optionally define a file extension for this language
|
;; add file extensions for sclang
|
||||||
(add-to-list 'org-babel-tangle-lang-exts '("sclang" . "scd"))
|
(add-to-list 'org-babel-tangle-lang-exts '("sclang" . "scd"))
|
||||||
|
|
||||||
;; optionally declare default header arguments for this language
|
;; declare default header arguments for sclang code blocks
|
||||||
(defvar org-babel-default-header-args:sclang
|
(defvar org-babel-default-header-args:sclang
|
||||||
'((:results . "none")))
|
'((:session . "*SCLang:Workspace*")
|
||||||
|
(:result . "none")))
|
||||||
|
|
||||||
(defun org-babel-expand-body:sclang (body params)
|
(defun org-babel-expand-body:sclang (body params)
|
||||||
"Expand BODY according to PARAMS, return the expanded body."
|
"Expand BODY according to PARAMS, return the expanded body."
|
||||||
|
@ -56,37 +57,34 @@
|
||||||
body))
|
body))
|
||||||
|
|
||||||
(defun org-babel-sclang-var-to-sclang (var)
|
(defun org-babel-sclang-var-to-sclang (var)
|
||||||
"Convert an elisp value to a string of sclang code represting the value of the
|
"Convert an elisp value VAR to a string of sclang code.
|
||||||
variable with correct type."
|
The value of the variable should be represented with correct type."
|
||||||
(if (listp var)
|
(if (listp var)
|
||||||
(concat "[" (mapconcat #'org-babel-sclang-var-to-sclang var ", ") "]")
|
(concat "[" (mapconcat #'org-babel-sclang-var-to-sclang var ", ") "]")
|
||||||
(cond ((stringp var) (format "%S" var))
|
(cond ((stringp var) (format "%S" var))
|
||||||
((floatp var) (format "%f" var))
|
((floatp var) (format "%f" var))
|
||||||
((integerp var) (format "%d" var))
|
((integerp var) (format "%d" var))
|
||||||
((symbolp var) (concat (format "%S" (symbol-name var)) ".asSymbol")))
|
((symbolp var) (concat (format "%S" (symbol-name var)) ".asSymbol")))))
|
||||||
))
|
|
||||||
|
|
||||||
(defun org-babel-execute:sclang (body params)
|
(defun org-babel-execute:sclang (body params)
|
||||||
"Execute a block of Sclang code with org-babel.
|
"Execute a block of sclang code with org-babel.
|
||||||
This function is called by `org-babel-execute-src-block'"
|
This function is called by `org-babel-execute-src-block' with BODY and PARAMS"
|
||||||
|
(sclang-eval-string (org-babel-expand-body:sclang body params)))
|
||||||
(sclang-eval-string (org-babel-expand-body:sclang body params))
|
|
||||||
)
|
|
||||||
|
|
||||||
(defun org-babel-prep-session:sclang (session params)
|
(defun org-babel-prep-session:sclang (session params)
|
||||||
"Prepare SESSION according to the header arguments specified in PARAMS."
|
"Prepare SESSION according to the header arguments specified in PARAMS."
|
||||||
(error "No need for session preparation")
|
(message "No need for session preparation"))
|
||||||
)
|
|
||||||
|
|
||||||
(defun org-babel-sclang-initiate-session (&optional session)
|
(defun org-babel-sclang-initiate-session (&optional session)
|
||||||
"If there is not a current inferior-process-buffer in SESSION then create.
|
"If there is not a current inferior-process-buffer in SESSION then create one.
|
||||||
Return the initialized session."
|
Return the initialized session."
|
||||||
(unless (string= session "none")
|
(unless (string= session "none")
|
||||||
(let (session (if sclang-library-initialized-p
|
(let ((session (if sclang-library-initialized-p
|
||||||
sclang-post-buffer
|
sclang-post-buffer
|
||||||
(save-window-excursion
|
(save-window-excursion
|
||||||
(sclang-start)
|
(sclang-start)
|
||||||
(current-buffer) ))))))
|
(current-buffer)))))
|
||||||
|
session)))
|
||||||
|
|
||||||
(provide 'ob-sclang)
|
(provide 'ob-sclang)
|
||||||
;;; ob-sclang.el ends here
|
;;; ob-sclang.el ends here
|
||||||
|
|
Loading…
Reference in a new issue