package ecaml

  1. Overview
  2. Docs
Library for writing Emacs plugin in OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=87e76473915e12d718096100a5c4d15d98aba6f99ecbf21814b7389e8c28bb25

doc/src/ecaml/working_directory.ml.html

Source file working_directory.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
open! Core
open! Import

type t =
  | Of_current_buffer
  | Root
  | This of string
[@@deriving sexp_of]

let to_filename = function
  | Of_current_buffer -> Current_buffer.(get_buffer_local_exn directory)
  | Root -> "/"
  | This s -> s
;;

let within t sync_or_async ~f =
  Current_buffer.set_value_temporarily
    sync_or_async
    (Buffer_local.var Current_buffer.directory)
    (Some (t |> to_filename))
    ~f
;;
OCaml

Innovation. Community. Security.