-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
racket-hash-lang: org source block {format edit tangle execute}
Closes issue #692 As far as I can tell, org source blocks and org-babel are designed around the assumption that each language will have its own major mode. Otherwise, the source block language isn't available in all scenarios. Therefore go with the flow: Even though racket-hash-lang-mode can handle all hash-langs, people will need to derive from it a new major mode for each lang they want to use with org source blocks. A new racket-define-hash-lang macro makes this easier, as well as handling related configuration like auto-mode-alist, org-src-lang-modes, and org-babel-tangle-lang-exts. With this we (intend to) fully support org source block formatting, editing, and tangling. When it comes to executing, we supply a basic org-babel-execute:<lang> function that knows how to run all hash-langs. However it only supports the :result-type output -- not values. And it does not support input :vars. In both cases, the syntax and semantics will of course vary among languages. However a user could define a org-babel-expand-body:<lang> to support :vars for a given lang. (But I don't yet have any how :result-type value would work.) One issue that comes up for all four scenarios is what to do about lang lines -- a Racket program must start with exactly one. 1. format: We use the back end hash-lang option to set the lang separately (as we also use for the REPL). 2. edit: The user need not include one. We add one automatically when they C-c ' to edit in the dedicated edit buffer), to keep things like racket-xp-mode happy. And we subtract it when writing back to the org buffer. 3. execute: We add one if the block lacks one. 4. tangle: It's up to the user to start the /first/ block (for each lang) with one, but not the remainder.
- Loading branch information
1 parent
483a1e7
commit 50d9a3a
Showing
1 changed file
with
247 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters