package sturgeon

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1.tar.gz
sha256=043a732477d2710bd55b2c004b6fce6c2fb8cbba3f9851caabcfe42b865d9926
md5=87f8441f38407fe1d941488b7d976d45

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_sessions 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) ()