summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2017-12-15 23:10:54 +0100
committerRicardo Wurmus <rekado@elephly.net>2017-12-15 23:15:32 +0100
commit42cdcdff1945b112452029c6a79445aac15ffd16 (patch)
treefebbc1a8d8980b89b6313157fc06401ef24b3506 /doc
parent7683bf1183cfd05e5c4475265687096589d0239e (diff)
downloadguix-42cdcdff1945b112452029c6a79445aac15ffd16.tar.gz
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.
Diffstat (limited to 'doc')
-rw-r--r--doc/contributing.texi28
1 files changed, 28 insertions, 0 deletions
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