Neomacs manages a collection of styles named by symbols. A style is either a mixin defined with defstyle
or a style sheet defined with defsheet
. A mixin specify a collection of CSS attributes, and a style sheet map CSS selectors to CSS attributes. Styles can inherit from each other. A buffer can include a list of style sheets (via buffer's styles
slot), which are compiled to CSS and injected into the renderer. Neomacs automatically updates affected CSS if any style is changed because of redefinition or set-style
.
Format of mixin style (defstyle
) spec: ({block | :key value}*)
, where each block has the format (selector {block | :key value}*)
Format of sheet style (defsheet
) spec: (block*)
Above :key
's are either CSS attribute names, or :inherit
, in which case value
should name a style which would be expanded in place.
defstyle
(symbol spec &optional doc)
defsheet
(symbol spec &optional doc)
*styles*
set-style
(&rest bindings)
css-cell
(symbol)
cell-ref
ed to get the up-to-date CSS string for the style
named by SYMBOL.If a style with the same name as a mode is present, enabling this mode will automatically load it into current buffer (therefore it should always be a style sheet rather than a mixin). This style sheet is intended for the mode to define styles for nodes it uses, and is therefore not removed when the mode is disabled, to avoid repeated loading in case the mode is enabled again later.
Sometimes you might want to use mode style sheets to modify appearance of a buffer, in which case you should add a disable-aux
method to remove such style sheet when the mode is disabled.
The renderer processes don't have direct access to your file system. To use local assets in the renderer (in HTML, CSS, JavaScript, etc), mount them under the neomacs
protocol scheme.
mount-asset
(host path)
By default, neomacs://sys/
is mounted to assets that come with Neomacs and neomacs://user/
is mounted to (uiop:xdg-config-home "neomacs/assets/")
(usually located at ~/.config/neomacs/assets/
on Unix-like systems). For example, neomacs://user/1.png
would access ~/.config/neomacs/assets/1.png
. neomacs://contents/
is reserved for internal use (currently, file-mode
use it to serve temporarily generated HTML).
apply-theme
(theme)
define-theme
(name doc &body bindings)
set-style
to apply the theme,
except the following special kinds of bindings:*themes*