From 42cdcdff1945b112452029c6a79445aac15ffd16 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 15 Dec 2017 23:10:54 +0100 Subject: etc: Add snippets. * etc/snippets/scheme-mode/guix-cvs-reference, etc/snippets/scheme-mode/guix-git-reference, etc/snippets/scheme-mode/guix-hg-reference, etc/snippets/scheme-mode/guix-origin, etc/snippets/scheme-mode/guix-package, etc/snippets/scheme-mode/guix-svn-reference, etc/snippets/text-mode/guix-commit-message-add-package, etc/snippets/text-mode/guix-commit-message-update-package: New files. * doc/contributing.texi (The Perfect Setup): Document snippets. --- doc/contributing.texi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'doc') diff --git a/doc/contributing.texi b/doc/contributing.texi index 1dd3ea8e1d..01f8aad9fb 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -193,6 +193,34 @@ facilities to directly operate on the syntax tree, such as raising an s-expression or wrapping it, swallowing or rejecting the following s-expression, etc. +@cindex code snippets +@cindex templates +@cindex reducing boilerplate +We also provide templates for common git commit messages and package +definitions in the @file{etc/snippets} directory. These templates can +be used with @url{http://joaotavora.github.io/yasnippet/, YASnippet} to +expand short trigger strings to interactive text snippets. You may want +to add the snippets directory to the @var{yas-snippet-dirs} variable in +Emacs. + +@lisp +;; @r{Assuming the Guix checkout is in ~/src/guix.} +(with-eval-after-load 'yasnippet + (add-to-list 'yas-snippet-dirs "~/src/guix/etc/snippets")) +@end lisp + +The commit message snippets depend on @url{https://magit.vc/, Magit} to +display staged files. When editing a commit message type @code{add} +followed by @kbd{TAB} to insert a commit message template for adding a +package; type @code{update} followed by @kbd{TAB} to insert a template +for updating a package. + +The main snippet for @code{scheme-mode} is triggered by typing +@code{package...} followed by @kbd{TAB}. This snippet also inserts the +trigger string @code{origin...}, which can be expanded further. The +@code{origin} snippet in turn may insert other trigger strings ending on +@code{...}, which also can be expanded further. + @node Coding Style @section Coding Style -- cgit v1.2.3