package sturgeon

  1. Overview
  2. Docs
A toolkit for communicating with Emacs

Install

dune-project
 Dependency

Authors

Maintainers

Sources

sturgeon-0.2.tbz
sha256=b74794477fca3e5b2a9d9f01a0e6dfa35d09db418aa72e5165e9f9bd40300401
md5=8157a30501b04f41fd7454c3c15dffb7

doc/src/sturgeon.recipes_command/sturgeon_recipes_command.ml.html

Source file sturgeon_recipes_command.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
open Sturgeon

let command ?greetings ?cogreetings () =
  let stdin = Sexp.of_channel stdin in
  let stdout sexp =
    Sexp.tell_sexp print_string sexp;
    print_newline ();
    flush stdout
  in
  let stdin', status = Session.connect ?greetings ?cogreetings stdout in
  let rec aux () =
    match stdin () with
    | None -> exit 0
    | Some sexp ->
      stdin' sexp;
      if Session.pending_continuations status > 0 then
        aux ()
      else exit 0
  in
  aux ()

let text_command f =
  let open Sexp in
  let greetings, shell = Stui.buffer_greetings () in
  command ~greetings ~cogreetings:(fun args -> f ~args shell) ()