Auto-insertion of boilerplate for Coleslaw

When opening a new .page or .post file, coleslaw-snippets will help you insert the metadata headers for the post. It uses coleslaw-mode to change the mode once the format: header is entered. Thus, coleslaw-mode is a dependency.

Example metadata header:

title: Example
format: md
date: 2442-01-01

The date is automatically the current date, and coleslaw-snippets prevents wrong format values; anything not stored in coleslaw-snippets-formats is rejected.

Default valid formats in coleslaw-snippets-formats:

'("md" "cl-who" "rst" "html" "org")


To install, clone the github page into your init directory, and add the following to your init file:

(require 'coleslaw-snippets)

If coleslaw-mode is installed, add

(add-hook 'coleslaw-mode-hook 'coleslaw-snippets)

to your init file. If not, the following will do:

(add-to-list 'auto-insert-alist '("\\.page\\'" . coleslaw-snippets-insert-header))
(add-to-list 'auto-insert-alist '("\\.post\\'" . coleslaw-snippets-insert-header))

Or, if coleslaw-mode is installed, use


Install coleslaw-mode and hook coleslaw-snippets onto it.

(add-hook 'coleslaw-mode-hook 'coleslaw-snippets)
(global-set-key (kbd "C-c H") 'coleslaw-insert-header)

You may also choose to use the autoinsert package to automatically insert the snippets into coleslaw markdown files. Then you would add: to your init.

Change the separator

Coleslaw allows changing the separator from the default ;;;;;, and you can change it in coleslaw-snippets with

(setq coleslaw-separator "-----")

in the init file.

Spenser Truex

hacker emblem
| |