Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jgkamat/alda-mode
An Alda Major Mode for Emacs
https://github.com/jgkamat/alda-mode
alda emacs emacs-mode
Last synced: about 2 months ago
JSON representation
An Alda Major Mode for Emacs
- Host: GitHub
- URL: https://github.com/jgkamat/alda-mode
- Owner: jgkamat
- License: gpl-3.0
- Archived: true
- Created: 2016-02-05T04:19:40.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-06-09T06:29:30.000Z (over 6 years ago)
- Last Synced: 2024-08-05T06:06:16.227Z (6 months ago)
- Topics: alda, emacs, emacs-mode
- Language: Emacs Lisp
- Homepage: https://gitlab.com/jgkamat/alda-mode
- Size: 103 KB
- Stars: 31
- Watchers: 5
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.org
- Changelog: CHANGELOG.org
- License: LICENSE
Awesome Lists containing this project
README
* This repository has moved to https://gitlab.com/jgkamat/alda-mode
* Alda Mode [[https://melpa.org/#/alda-mode][file:https://melpa.org/packages/alda-mode-badge.svg]] [[https://stable.melpa.org/#/alda-mode][file:https://stable.melpa.org/packages/alda-mode-badge.svg]] [[https://circleci.com/gh/jgkamat/alda-mode][file:https://circleci.com/gh/jgkamat/alda-mode.svg?style=shield]]
The best way to edit your [[https://github.com/alda-lang/alda][alda]] files in Emacs!
Alda mode is a simple mode to provide syntax highlighting and other basic
language features for [[https://github.com/alda-lang/alda][Alda, the music programming language]] written in Clojure.[[http://i.imgur.com/lRAA27L.png]]
** Installation
:PROPERTIES:
:CUSTOM_ID: installation
:END:The easiest way to install alda-mode is through [[http://melpa.org/#/getting-started][melpa]]. Simply
~M-x package-install~ ~alda-mode~.Once installed, place ~(require 'alda-mode)~ in your init.el.
For evil integration,
[[https://github.com/jgkamat/alda-mode#evil-integration][simply install evil before alda-mode]].Alda files (~.alda~ extension) should now have syntax highlighting via
font-lock-mode when opened.If melpa won't work for you, ~M-x package-install-file~ alda-mode.el
from this repository instead.** Alda Playback
:PROPERTIES:
:CUSTOM_ID: usage
:END:alda-mode can play segments of alda from within Emacs! Simply highlight
a section of alda code and run:~M-x alda-play-region~
This will take a while during the first call, which will start the alda server
within Emacs (if not already on your system). ~alda~ will need to be on your
path.Many other commands are available too, to allow playing an entire buffer, a
file, or more!Please submit any bugs with this feature as issues to this repository.
*** DONE Alda History
CLOSED: [2017-08-03 Thu 18:49]When playing a region, sometimes you need 'context' for the playback. In alda,
this is provided as 'history' through the java client, through ~alda play
--history~.# Alda mode org babel hype! (I wish)
#+BEGIN_SRC alda
midi-square-wave:
o2 c8 d e f g a b > c
c < b a g f e d c
#+END_SRCIf you select and play the notes, without the ~midi-square-wave:~ header, you
will not hear any sound, as you have not selected an instrument. While you are
composing, you probably don't want to select the entire score every time, so
what you can do is add parts of the score you depend on to history!#+BEGIN_SRC alda
midi-square-wave: # Highlight, and run 'alda-history-append-region'
o2 c8 d e f g a b > c
# now you can debug the notes on this line, without waiting for the line above
c < b a g f e d c
#+END_SRCIf you wish to clear your history and return to a blank slate, run
~alda-history-clear~. This can be useful for debugging issues in ~alda-mode~,
and can speed up alda execution if you added a lot to the history.In previous releases, when the history was included in alda by default, history
was applied for every command. This is not supported in ~alda-mode~ yet, but if
you are interested, let me know!*** Custom Alda Binary
If you want to use a custom ~alda~ binary, set ~alda-binary-location~ to
your alda binary. Ex:
~(setq alda-binary-location "/usr/local/bin/alda")~Keep in mind, the server will only see the selection you make, and this
has consequences. For example, you must run a snippet of code defining
an instrument before you hear anything (or defining a marker before
using it). ~alda-play-region~ will use a running ~alda~ server if it finds
one, but will start one within Emacs if not found. Support is currently
only tested under Linux for this command. Mac will probably work depending
on your emacs install.** Evil Integration
:PROPERTIES:
:CUSTOM_ID: evil-integration
:END:Evil integration is automatically applied if you install evil before
alda-mode. If you are installing evil after alda-mode, please
reinstall/recompile alda-mode.#+BEGIN_SRC emacs-lisp
(package-install 'evil)
(package-install 'alda-mode)
(require 'alda-mode)
#+END_SRCThis will make a evil operator called ~alda-evil-play-region~, defined
when you require evil. If evil was not installed, this is replaced with
a warning message.** Keybindings
:PROPERTIES:
:CUSTOM_ID: keybindings
:END:alda-mode adds a couple simple keybindings by default. These are documented below:
| Keybind | Function | Explanation |
|-----------+------------------+--------------------------------------------------|
| ~C-c C-r~ | alda-play-region | Plays selected text |
| ~C-c C-c~ | alda-play-block | Plays the paragraph on point |
| ~C-c C-n~ | alda-play-line | Plays a single line |
| ~C-c C-b~ | alda-play-buffer | Plays the entire buffer, as text (not as a file) |Here are some simple example keybinds for evil integration (or if you want to add your own custom keybindings):
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-c a") 'alda-play-region) ;; Global alda-play-map
;; Requires evil integration
(define-key evil-motion-state-map "gp" 'alda-evil-play-region)
#+END_SRCThis will map ~C-c a~ to play a selected region, and ~gp~ to be an evil
operator to do the same thing! (~gpp~ will play the current line,
~gp20j~ plays 20 lines, etc).** Contributing
:PROPERTIES:
:CUSTOM_ID: contributing
:END:If you find a bug or want to improve alda-mode, submit a PR or file an issue! ~=)~
** License
:PROPERTIES:
:CUSTOM_ID: license
:END:alda-mode is licensed under the GPLv3.