doomemacs/modules/feature/file-templates
Henrik Lissner 99e916348a
lang/java: fix java namespace resolution #1098
Now uses slightly more sophisticated namespace resolution when
populating the *.java file template.
2019-01-21 17:39:39 -05:00
..
templates lang/java: fix java namespace resolution #1098 2019-01-21 17:39:39 -05:00
autoload.el Remove deprecated set! & def-setting! macros 2019-01-05 17:48:46 -05:00
config.el Rule is too restrict for file templates 2018-10-06 23:52:18 +08:00
packages.el Refactor feature/file-templates 2018-06-03 23:43:27 +02:00
README.org feature/file-template: add README (WIP) 2019-01-03 01:51:34 -05:00

feature/file-templates

Description

This module adds file templates for blank files, powered by yasnippet.

Module Flags

This module provides no flags.

Plugins

This module installs no plugins.

Prerequisites

This module has no prerequisites.

Usage

File templates are automatically expanded when opening empty files.

They are also regular yasnippet snippets, which can be expanded by typing their trigger and pressing TAB. By convention, the triggers for file templates are prefixed with two underscores __.

Inserting OSS licenses

A special command is available for inserting software licenses: M-x +file-templates/insert-license.

Licenses with a -bp suffix are boilerplate templates; shorter versions meant for comment headers in code.

Configuration

TODO Registering a new file template

TODO Changing existing file templates

Adding new OSS licenses

The +file-templates/insert-license command searches for snippets under text-mode that are named __license-ABC, where ABC is the short name of the license. e.g. __license-mit.

So long as these files exist, +file-templates/insert-license will recognize them.

Troubleshooting

If a file template isn't expanding where you expect it to, run M-x +file-templates/debug. This will report to you what file template rule would apply for the correct file.

Appendix

API

  • set-file-template! PRED &rest PLIST
  • set-file-templates! &rest TEMPLATES

Commands

  • +file-templates/insert-license
  • +file-templates/debug

Variables

  • +file-templates-dir
  • +file-templates-default-trigger
  • +file-templates-alist