Skip to content

rubenphilipp/aby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aby

examples/demo.gif

Aby[fn:1] (aby-mode) is a simple fragment/snippet manager for Emacs. This minor-mode lets you easily insert the contents of files from a designated snippets directory into an Emacs buffer by using the command aby-insert.

Furthermore, Aby is capable of dynamically altering certain elements in a fragment file by using custom defined functions (cf. the documentation for aby/aby-instruct for more information on building instruction lists).

Example

M-x aby-insert lisp/robodoc-class

will search for a file in the aby-fragments-dir, matching the aby-file-extension (default aby.el). It will evaluate the Elisp expressions in this file in a temp-buffer, expecting an association list with replacements rules as the return value. Again, the documentation of aby/aby-instruct shed some light on the data structure.

The resulting replacements rules will the be parsed by the aby-insert function, which performs variable allocations and regex-replacements, and eventually inserts the resulting string into the current buffer.

abyss – Plain Fragments

Besides the fully fledged, gold standard way of inserting Aby snippets – as described above –, it is also possible to omit the process of calling (or creating) an instruction-file prior to inserting the snippet. For cases that don’t require explicit replacements instructions (as given in a replacement-file via the replacement-rules), it is possible to skip the creation of an instruction-file and just create a fragment-file which is immediately inserted into the buffer. The only replacements which will be made are those prescribed via the auto-replacements (cf. doc for aby/aby-auto-replacements).

In order to create fragments/snippets, which will be inserted via this method, add files to the fragment directory with a specific addition to the suffix, indicating that this file is to be parsed as a plain-fragment during the aby-insert process. The default suffix-indicator is

".abyss\\.?+\\..+$"

which is a Elisp RegEx, indicating that all files which end with an arbitrary extension plus a trailing suffix (.abyss) should be considered as Plain Fragments.[fn:2] Thus, the files simple-html.abyss.html and function.abyss.lisp will be interpreted as Plain Fragment files:

class.lisp
function.aby.el
function.lisp
function.abyss.lisp
method.aby.el
simple-html.abyss.html
method.lisp
module.aby.el

Installation

Place the files of the aby-mode on your hard-drive and load the files to your Emacs configuration, e.g. via:

(add-to-list 'load-path "~/.emacs.d/aby/src/")
(require 'aby-mode)

;; load your custom Aby config (optional, see below)
(load "~/someplace/aby-config.el")

These expressions could be placed in your .emacs file.

Configuration

In order to alter the Aby configuration, you can modify the config variables (cf. the variables documentation in the doc) after load. An example config-file can be found on /examples/aby-config.el.

Usage

As exemplified in the previous example, an Aby snippet is inserted via the aby-insert command. The examples directory contains a (somewhat “recursive”) file for creating Aby instruction-files (cf. examples/fragments/aby/aby-instruct.aby.el). This one comes in very handy when creating new aby-instruct files (cf. doc).

Help

The /examples directory contains examples both for configuration and the creation of Aby fragments (i.e. instruction and snippet files). Detailed insight on how to construct instruction files and information on the parsing/insertion process can be gained by reading the /doc (dive in via /doc/index.html) and especially examining the functions aby/aby-instruct and aby/aby-insert.

Footnotes

[fn:1] https://en.wikipedia.org/wiki/Aby_Warburg [fn:2] For more on Elisp RegEx (Regular Expressions), cf. the Emacs manual and the EmacsWiki.

About

Aby is a snippet orchestrator for Emacs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published