package ecaml

  1. Overview
  2. Docs
Module type
Class type

Buffers are used to hold the contents of files that are being visited; there may also be buffers that are not visiting files.

  • (Info-goto-node "(elisp)Buffers")
module Hook := Ecaml__.Hook0
include Ecaml_value.Value.Subtype with type t = Ecaml_value__.Value0.t
type t

We expose private value for free identity conversions when the value is nested in some covariant type, e.g. (symbols : Symbol.t list :> Value.t list) rather than symbols ~f:Symbol.to_value.

val sexp_of_t : t -> Sexplib0.Sexp.t
val eq : t -> t -> bool

eq t1 t2 = Value.eq (to_value t1) (to_value t2), i.e. eq checks whether the Emacs values underlying t1 and t2 are physically equal. This is different than phys_equal t1 t2, because we don't always wrap eq Emacs values in phys_equal OCaml values. I.e. phys_equal t1 t2 implies eq t1 t2, but not the converse.

val is_in_subtype : Ecaml_value.Value.t -> bool
val of_value_exn : Ecaml_value__.Value0.t -> t
val to_value : t -> Ecaml_value__.Value0.t
type buffer := t
include Core.Equal.S with type t := t
val equal : t Base.Equal.equal


val file_name : t -> string option
  • (describe-function 'buffer-file-name)
val is_live : t -> bool
  • (describe-function 'buffer-live-p)
val name : t -> string option
  • (describe-function 'buffer-name)
val process : t -> Ecaml_value__.Value0.t option
  • (describe-function 'get-buffer-process)
val process_exn : t -> Ecaml_value__.Value0.t
val all_live : unit -> t list

all_live returns a list of all live buffers. (describe-function 'buffer-list).

val create : name:string -> t

create ~name creates a new buffer with name name, adjusting the name if necessary to make the buffer's name unique. (describe-function 'generate-new-buffer).

val find : name:string -> t option

find ~name returns the live buffer whose name is name, if any. (describe-function 'get-buffer).

val find_by : f:(t -> bool) -> t option

Find a live buffer using f

val find_exn : name:string -> t
val find_visiting : file:Filename.t -> t option

(describe-function 'get-file-buffer). (Info-goto-node "(elisp)Buffer File Name")

val find_or_create : name:string -> t

find ~name returns the live buffer whose name is name, and if there is no such buffer, creates it. (describe-function 'get-buffer-create).

val kill : t -> unit Async_kernel.Deferred.t

kill t kills t, so that not (is_live t). (describe-function 'kill-buffer).

module Blocking : sig ... end
val displayed_in : ?current_frame_only:bool -> t -> Ecaml_value.Value.t list

Return a list of all windows on the current terminal that are displaying the given buffer.

(describe-function 'get-buffer-window-list)

val display : t -> Ecaml_value.Value.t option

(Info-goto-node "(elisp)Choosing Window") (describe-function 'display-buffer)

val display_i : t -> unit

Like display, but ignores the result.

val buffer_local_value : t -> 'a Var.t -> 'a

(describe-function 'buffer-local-value) (Info-goto-node "(elisp)Creating Buffer-Local")

val buffer_local_variables : t -> (Symbol.t * Ecaml_value.Value.t option) list

(describe-function 'buffer-local-variables) (Info-goto-node "(elisp)Creating Buffer-Local")

val find_file_noselect : Filename.t -> t Async_kernel.Deferred.t

(describe-function 'find-file-noselect) (Info-goto-node "(elisp)Visiting Functions")

See also Selected_window.find_file.

val is_internal_or_dead : t -> bool

From (Info-goto-node "(emacs)Select Buffer"):

Emacs uses buffer names that start with a space for internal purposes. It treats these buffers specially in minor ways---for example, by default they do not record undo information. It is best to avoid using such buffer names yourself.

As dead buffers have no names, it is unknown whether a dead buffer was internal.

module Which_buffers : sig ... end
val save_some : ?query:bool -> ?which_buffers:Which_buffers.t -> unit -> unit Async_kernel.Deferred.t

(describe-function 'save-some-buffers) (Info-goto-node "(elisp)Saving Buffers")

val with_temp_buffer : ?name:string -> (_, 'a) Sync_or_async.t -> (t -> 'a) -> 'a
val revert : ?confirm:bool -> t -> unit Async_kernel.Deferred.t

(describe-function 'revert-buffer) (Info-goto-node "(elisp)Reverting")

val kill_buffer_query_functions : (unit, bool) Hook.t

(describe-variable 'kill-buffer-query-functions)

val modified_tick : t -> Modified_tick.t

(describe-function 'buffer-modified-tick)

val chars_modified_tick : t -> Modified_tick.t

(describe-function 'buffer-chars-modified-tick)

val is_modified : t -> bool

(describe-function 'buffer-modified-p)


Innovation. Community. Security.