暂无描述

Samuel W. Flint 3a18ecc8ce Upped Version 8 年之前
.gitignore 0d1638212b Added some stuff to the gitignore file 8 年之前
LICENSE 73ea9ff0f4 Initial commit 8 年之前
README.md 7af76e5d57 Added my MELPA Badge 8 年之前
buffer-layers.el 3a18ecc8ce Upped Version 8 年之前
buffer-layers.layer fa59602e61 Fixed the buffer layer application wierdness 8 年之前
test.el b60a933328 Fixed definition saving stuff 8 年之前

README.md

This is Buffer Layers, a simple, layer-based buffer management system.

It works by defining buffer layers using a fairly simple macro. The following would be put in a file called org.layer

;; -*- emacs-lisp -*-
(define-buffer-layer org
  :files ("~/org/"
          "~/org/main.org")
  :buffer-to-select "main.org"
  :run-on-apply ((my/find-current-notes-file)))

It can be loaded with (load-buffer-layer "/path/to/org.layer" nil). If the final nil is changed to t, it will load and apply the layer.

Buffer Layer Definitions take the following arguments:

  • :files: A list. This is the list of files that are loaded when the buffer layer is applied.
  • :buffer-to-select: The buffer to select after files are loaded, and the given forms to run on application are executed.
  • :run-on-apply: This is a list of forms to be executed in between finding files and selecting the given buffer.
  • :run-on-remove: This is a list of forms to be executed after killing the buffers that have been loaded.

To manipulate buffer layers, execute buffer-layer-mode, and then you can use the following keybindings:

  • C-x L l: Load a buffer layer, if defined, otherwise, load from the given file.
  • C-x L u: Unload a loaded buffer layer.
  • C-x L U: Unload all loaded buffer layers.
  • C-x L L: List defined buffer layers, noting if they've been applied.

The following are the user-facing functions:

  • define-buffer-layer
  • buffer-layer-load-buffer-layer, also known as load-buffer-layer
  • buffer-layers-unload-buffer-layer
  • buffer-layers-list
  • buffer-layers-unload-all-buffer-layers
  • buffer-layers-mode

On enabling buffer-layer-mode, the map is placed onto C-x L, and buffer-layers-unload-all-buffer-layers is added to the kill-emacs-hook, and on disabling the mode, they are removed.

MELPA