8000 GitHub - zzamboni/ob-elvish: Org Babel support for Elvish
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

zzamboni/ob-elvish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Org Babel functions for Elvish

This package provides the ability to execute source code blocks written in the Elvish shell language within an org-mode buffer.

Table of Contents

Installation

From source

Clone this repo, add it to your load path and load the package using `require`:

(add-to-list 'load-path "~/src/ob-elvish/")
(require 'ob-elvish)

From MELPA

(in process, will update this section when it’s available)

Usage

For an excellent introduction to literate programming using org-mode, see Howard Abrams’ Introduction to Literate Programming.

Once you have both org-mode and ob-elvish loaded, you can type Elvish code inside an org-mode src block. For example:

#+begin_src elvish
  put "This is Elvish"
#+end_src

If you press Ctrl-c Ctrl-c to execute the block, you will see the output in a results block below:

#+RESULTS:
: ▶ 'This is Elvish'

You can specify variables using the standard :var header argument:

#+begin_src elvish :var n=3
  put "The result is "(* $n 5)
#+end_src

#+RESULTS:
: ▶ 'The result is 15'

You can use the :use header argument to specify modules which should be loaded with use before executing the code. You can specify multiple packages by separating them with commas:

#+begin_src elvish :use re,str :exports none
    pprint (re:find '^(\S+)' (str:to-lower "Hello there"))
#+end_src

#+RESULTS:
#+begin_example
[
 &text=	hello
 &start=	0
 &end=	5
 &groups=	[
   [
    &text=	hello
    &start=	0
    &end=	5
   ]
   [
    &text=	hello
    &start=	0
    &end=	5
   ]
  ]
]
#+end_example

About

Org Babel support for Elvish

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0