Coder Social home page Coder Social logo

sdelafond / emacs-ob-racket Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hasu/emacs-ob-racket

0.0 1.0 0.0 36 KB

Emacs Org-Mode Babel code block Racket support

Home Page: https://tero.hasu.is/blog/2011-09-08-on-racket-support-in-emacs-org-mode.html

License: GNU General Public License v3.0

Emacs Lisp 69.09% Racket 30.30% Makefile 0.61%

emacs-ob-racket's Introduction

An Emacs feature that defines support for Org-Mode Babel code blocks written in Racket.

Includes support for many of the usual Org SRC block header arguments (with the notable exception of :session), as well as some extras for controlling the way that code blocks are evaluated. The additional controls are perhaps more important for Racket than for most other languages, since Racket is not just one language. Rather, Racket is an open-ended, user-extensible collection of languages (including, e.g., Racket, Scribble, Slideshow, Redex, and Magnolisp), which may not always be evaluated in the Racket VM in the usual way of just invoking the racket executable.

Pre-Requisites

To use ob-racket, first ensure that Org-Mode is installed in Emacs, as it probably is. For a richer editing experience you may also want to ensure that a major mode (such as racket-mode) has been configured for editing racket code blocks in Org.

If your mode for editing Racket code is not called racket-mode, you’ll want to specify the mode to use with something like:

(add-to-list 'org-src-lang-modes '("racket" . geiser))

Installation

Firstly, you may want to byte compile the “ob-racket.el” file, for example by invoking the byte-compile-file function under Emacs.

Then make sure the ob-racket feature is on Emacs’ load-path so that it can be loaded on demand:

(add-to-list 'load-path "/my/path/to/emacs-ob-racket")

Furthermore, you should enable racket code for evaluation (e.g., upon invoking org-babel-execute-src-block, by default bound to C-c C-c under Org) by making available the *:racket definitions of the ob-racket feature. One way to do that is to simply require the feature, but Org can also be made to load ob-racket by having the customizable org-babel-load-languages variable include racket. Programmatically, something like this should do the trick:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (racket . t)
   ;;(scribble . t) ;; if Scribble support is available
   ))

Code evaluation may still require confirmation, depending on the value of the org-confirm-babel-evaluate variable, which is customizable, and may also be set file locally.

Some ob-racket functionality relies on a Racket module for converting Racket values to Emacs Lisp ones, and it can be worthwhile to byte-compile that module:

raco make ob-racket-runtime.rkt

Installation with straight.el

The cloning, byte-compilation, loading, and configuration can all be done declaratively with straight.el, use-package, and the included ob-racket-raco-make-runtime-library function:

(use-package ob-racket
  :after org
  :config
  (add-hook 'ob-racket-pre-runtime-library-load-hook
	      #'ob-racket-raco-make-runtime-library)
  :straight (ob-racket
	       :type git :host github :repo "hasu/emacs-ob-racket"
	       :files ("*.el" "*.rkt")))

Documentation

There is no separate documentation for ob-racket, so look at the source code, and the Emacs Lisp docstrings of the functions and variables appearing there. You will probably also find the relevant Org documentation useful:

(progn
  (info-display-manual "org")
  (Info-goto-node "Working With Source Code"))

emacs-ob-racket's People

Contributors

hasu avatar freeduck avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.