diff --git a/faq.html b/faq.html index bd4f9c6..c2e003a 100644 --- a/faq.html +++ b/faq.html @@ -3,21 +3,28 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ +If there is a newline at the end of a snippet definition file, YASnippet will add a newline when expanding that snippet. When editing @@ -186,16 +284,15 @@ final newline automatically.
A workaround is to inhibit flyspell overlays while the snippet is active:
(add-hook 'flyspell-incorrect-hook
#'(lambda (dummy1 dummy2 dymmy3)
(and yas-active-field-overlay
@@ -214,16 +311,15 @@ solve this problem, drop a line in the
Edit the keymaps yas-minor-mode-map
and
yas-keymap
as you would any other keymap:
(define-key yas-minor-mode-map (kbd "<tab>") nil)
(define-key yas-minor-mode-map (kbd "TAB") nil)
(define-key yas-minor-mode-map (kbd "<the new key>") yas-maybe-expand)
@@ -240,16 +336,15 @@ Edit the keymaps yas-m
The best way, since version 0.6.1c, is to set the default value of the
variable yas-dont-activate
to a lambda function like so:
(set-default 'yas-dont-activate
#'(lambda ()
(and yas-root-directory
@@ -265,15 +360,14 @@ but only once you have setup your yas-root-directory.
@@ -290,7 +384,6 @@ directive:
# key: < # name: <...></...> # -- @@ -301,7 +394,7 @@ directive:
Generated by Emacs 25.2.50.5 (Org mode 8.2.10) from 0.12.2 (2017-08-29 02:08:58)
+Generated by Emacs 26.1 (Org mode 9.1.9) from 0.13.0 (2018-05-13 16:12:51)
Generated by Emacs 25.2.50.5 (Org mode 8.2.10) from 0.12.2 (2017-08-29 02:08:58)
+Generated by Emacs 26.1 (Org mode 9.1.9) from 0.13.0 (2018-05-13 16:12:51)
# key:
snippet abbrev# name:
snippet name# condition:
snippet condition# group:
snippet menu grouping# expand-env:
expand environment# binding:
direct keybinding# type:
snippet
or command
# uuid:
unique identifier# contributor:
snippet author# key:
snippet abbrev# name:
snippet name# condition:
snippet condition# group:
snippet menu grouping# expand-env:
expand environment# binding:
direct keybinding# type:
snippet
or command
# uuid:
unique identifier# contributor:
snippet authorThere are some ways you can quickly find a snippet file or create a new one:
M-x yas-new-snippet
, key bindind: C-c & C-n
+
+M-x yas-new-snippet
, key bindind: C-c & C-n
+
Creates a new buffer with a template for making a new snippet. The
-buffer is in snippet-mode
(see below). When you are done editing
-the new snippet, use C-c C-c
to save it.
-
snippet-mode
(see below). When you are done editing
+the new snippet, use C-c C-c
to save it.
+
-M-x yas-visit-snippet-file
, key binding: C-c & C-v
+
+M-x yas-visit-snippet-file
, key binding: C-c & C-v
+
Prompts you for possible snippet expansions like
yas-insert-snippet
, but instead of expanding it, takes you directly
to the snippet definition's file, if it exists.
-
-Once you find this file it will be set to snippet-mode
(see ahead)
+Once you find this file it will be set to snippet-mode
(see ahead)
and you can start editing your snippet.
snippet-mode
major mode snippet-mode
major mode
There is a major mode snippet-mode
to edit snippets. You can set the
buffer to this mode with M-x snippet-mode
. It provides reasonably
@@ -251,16 +346,19 @@ Three commands are defined in this mode:
M-x yas-load-snippet-buffer
, key binding: C-c C-l
+
+M-x yas-load-snippet-buffer
, key binding: C-c C-l
+
Prompts for a snippet table (with a default based on snippet's major mode) and loads the snippet currently being edited. -
-M-x yas-load-snippet-buffer-and-close
, key binding: C-c C-c
-
+
+M-x yas-load-snippet-buffer-and-close
, key binding: C-c C-c
+
+
Like yas-load-snippet-buffer
, but also saves the snippet and
@@ -268,17 +366,17 @@ calls quit-window
. The destination is decided based on the
chosen snippet table and snippet collection directly (defaulting to
the first directory in yas-snippet-dirs
(see Organizing Snippets
for more detail on how snippets are organized).
-
M-x yas-tryout-snippet
, key binding: C-c C-t
+
+M-x yas-tryout-snippet
, key binding: C-c C-t
+
When editing a snippet, this opens a new empty buffer, sets it to the appropriate major mode and inserts the snippet there, so you can see what it looks like. -
-
@@ -289,9 +387,9 @@ There are also snippets for writing snippets: vars
, $f
A file defining a snippet generally contains the template to be expanded. @@ -310,7 +408,6 @@ Here's a typical example:
# contributor: pluskid <pluskid@gmail.com> # name: __...__ # -- @@ -323,21 +420,21 @@ Here's a list of currently supported directives:
# key:
snippet abbrev# key:
snippet abbrev
This is the probably the most important directive, it's the
abbreviation you type to expand a snippet just before hitting the key
-that runs yas-expand
. If you don't specify this
+that runs yas-expand
. If you don't specify this,
the snippet will not be expandable through the trigger mechanism.
# name:
snippet name# name:
snippet nameThis is a one-line description of the snippet. It will be displayed in the menu. It's a good idea to select a descriptive name for a snippet – @@ -345,15 +442,15 @@ especially distinguishable among similar snippets.
-If you omit this name it will default to the file name the snippet was -loaded from. +If you omit this name, it will default to the file name the snippet +was loaded from.
# condition:
snippet condition# condition:
snippet condition
This is a piece of Emacs-lisp code. If a snippet has a condition, then
it will only be expanded when the condition code evaluate to some
@@ -367,9 +464,9 @@ See also yas-b
# group:
snippet menu grouping# group:
snippet menu grouping
When expanding/visiting snippets from the menu-bar menu, snippets for a
given mode can be grouped into sub-menus . This is useful if one has too
@@ -393,9 +490,9 @@ group which is under the control structure
group.
# expand-env:
expand environment# expand-env:
expand environment
This is another piece of Emacs-lisp code in the form of a let
varlist
form, i.e. a list of lists assigning values to variables. It can be
@@ -415,7 +512,6 @@ You can then use:
# name: ASCII home # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil)) # -- @@ -434,9 +530,9 @@ You can then use:
# binding:
direct keybinding# binding:
direct keybindingYou can use this directive to expand a snippet directly from a normal Emacs keybinding. The keybinding will be registered in the Emacs keymap @@ -450,11 +546,10 @@ same snippet, for example in this "html-mode" snippet.
# name: <p>...</p> # binding: C-c C-c C-m # -- -<p>`(when yas-prefix "\n")`$0`(when yas-prefix "\n")`</p> +<p>`(when yas-prefix "\n")`$0`(when yas-prefix "\n")`</p>
# type:
snippet
or command
# type:
snippet
or command
If the type
directive is set to command
, the body of the snippet
is interpreted as lisp code to be evaluated when the snippet is
@@ -477,15 +572,15 @@ triggered.
If it's snippet
(the default when there is no type
directive), the
-snippet body will be parsed according to the Template Syntax,
+snippet body will be parsed according to the Template Syntax,
described below.
# uuid:
unique identifier# uuid:
unique identifierThis provides to a way to identify a snippet, independent of its name. Loading a second snippet file with the same uuid would replace the @@ -494,9 +589,9 @@ previous snippet.
# contributor:
snippet author# contributor:
snippet authorThis is optional and has no effect whatsoever on snippet functionality, but it looks nice. @@ -505,18 +600,18 @@ but it looks nice.
The syntax of the snippet template is simple but powerful, very similar to TextMate's.
Arbitrary text can be included as the content of a template. They are
usually interpreted as plain text, except $
and `
. You need to
@@ -526,9 +621,9 @@ escaped as \\
sometimes.
Emacs-Lisp code can be embedded inside the template, written inside
back-quotes (`
). The lisp forms are evaluated when the snippet is
@@ -542,7 +637,6 @@ dynamically:
#ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_} #define $1 @@ -559,7 +653,6 @@ therefore define a snippet like:--for ($1;$2;$3) { `yas-selected-text`$0 } @@ -573,9 +666,9 @@ Alternatively, you can also customize the variable-Note: backquote expressions should not modify the buffer
-++Note: backquote expressions should not modify the buffer
+-Please note that the lisp forms in backquotes should not modify the buffer, doing so will trigger a warning. For example, instead of @@ -583,7 +676,6 @@ doing
-@@ -592,7 +684,6 @@ doing do this:Timestamp: `(insert (current-time-string))`-@@ -601,7 +692,6 @@ do this: The warning may be suppressed with the following code in your init file:Timestamp: `(current-time-string)`-@@ -610,9 +700,9 @@ The warning may be suppressed with the following code in your init file:(add-to-list 'warning-suppress-types '(yasnippet backquote-change))-Tab stop fields
-++-Tab stop fields
+Tab stops are fields that you can navigate back and forth by
TAB
andS-TAB
. They are written by$
followed with a number.$0
has the @@ -621,7 +711,6 @@ to go when you've traveled all the fields. Here's a typical example:-<div$1> $0 </div> @@ -629,40 +718,38 @@ to go when you've traveled all the fields. Here's a typical example:-Placeholder fields
-++-Placeholder fields
+Tab stops can have default values – a.k.a placeholders. The syntax is like this:
-${N:default value}
-They acts as the default value for a tab stop. But when you firstly +They act as the default value for a tab stop. But when you first type at a tab stop, the default value will be replaced by your typing. -The number can be omitted if you don't want to create mirrors or -transformations for this field. +The number can be omitted if you don't want to create mirrors or +transformations for this field.
-Mirrors
-++Mirrors
+--We refer the tab stops with placeholders as a field. A field can have -mirrors. Its mirrors will get updated when you change the text of a -field. Here's an example: +We refer the tab stops with placeholders as a field. A field can +have mirrors. All mirrors get updated whenever you update any field +text. Here's an example:
-\begin{${1:enumerate}} $0 \end{$1} @@ -683,9 +770,9 @@ the field and others mirrors.-Mirrors with transformations
-++Mirrors with transformations
+If the value of an
${n:
-construct starts with and contains$(
, then it is interpreted as a mirror for fieldn
with a @@ -697,7 +784,6 @@ Objective-C:-- (${1:id})${2:foo} { return $2; @@ -729,7 +815,6 @@ should be at least as long as the text. So--===== Title ===== @@ -741,7 +826,6 @@ is a valid title but-=== Title === @@ -753,7 +837,6 @@ is not. Here's an snippet for rst title:-+ +${1:$(make-string (string-width yas-text) ?\=)} ${1:Title} ${1:$(make-string (string-width yas-text) ?\=)} @@ -761,17 +844,36 @@ is not. Here's an snippet for rst title: $0+Note that a mirror with a transform is not restricted to the text of +the field it is mirroring. By making use of
+ +yas-field-value
, a +mirror can look at any of the snippet's field (as mentioned above, all +mirrors are updated when any field is updated). Here is an example +which shows a "live" result of calling format: +++ +(format "${1:formatted %s}" "${2:value}") +=> "${1:$(ignore-errors (format (yas-field-value 1) (yas-field-value 2)))}" +++To keep the example simple, it uses
ignore-errors
to suppress errors +due to incomplete format codes. +-Fields with transformations
-++-Fields with transformations
+From version 0.6 on, you can also have lisp transformation inside -fields. These work mostly mirror transformations but are evaluated when -you first enter the field, after each change you make to the field and -also just before you exit the field. +fields. These work mostly like mirror transformations. However, they +are evaluated when you first enter the field, after each change you +make to the field and also just before you exit the field.
@@ -781,6 +883,7 @@ distinguish between fields and mirrors. In the following example
#define "${1:mydefine$(upcase yas-text)}" +@@ -798,6 +901,7 @@ transformation's
$
. If you don't want this extra-text, you can use#define "${1:$$(upcase yas-text)}" +@@ -809,9 +913,9 @@ does not take place. This is by design.
-Choosing fields value from a list and other tricks
-++Choosing fields value from a list and other tricks
+-As mentioned, the field transformation is invoked just after you enter the field, and with some useful variables bound, notably @@ -825,8 +929,7 @@ The
yas-choose-value
- -@@ -858,22 +960,21 @@ of<div align="${2:$$(yas-choose-value '("right" "center" "left"))}"> +<div align="${2:$$(yas-choose-value '("right" "center" "left"))}"> $0 </div>@@ -843,10 +946,9 @@ enter snippet field 2. This one makes use of - -\section{${1:"Titel der Tour"}}% +\section{${1:"Titel der Tour"}}% \index{$1}% -\label{{2:"waiting for reftex-label call..."$(unless yas-modified-p (reftex-label nil 'dont- +\label{{2:"waiting for reftex-label call..."$(unless yas-modified-p (reftex-label nil 'dont- insert))}}%yas-moving-away-p
-Nested placeholder fields
-++-Nested placeholder fields
+From version 0.6 on, you can also have nested placeholders of the type:
- -<div${1: id="${2:some_id}"}>$0</div> +<div${1: id="${2:some_id}"}>$0</div>This allows you to choose if you want to give this
div
anid
-attribute. If you tab forward after expanding it will let you change +attribute. If you tab forward after expanding, it will let you change "some\id" to whatever you like. Alternatively, you can just pressC-d
(which executesyas-skip-and-clear-or-delete-char
) and go straight to the exit marker. @@ -887,9 +988,9 @@ performs the normal Emacsdelete-char
command.-Indentation markers
-++Indentation markers
+If
yas-indent-line
is not set to 'auto
, it's still possible to indent specific lines by adding an indentation marker,$>
, somewhere @@ -900,7 +1001,7 @@ on the line.-diff --git a/snippet-expansion.html b/snippet-expansion.html index e9aacfe..b043eca 100644 --- a/snippet-expansion.html +++ b/snippet-expansion.html @@ -3,21 +3,28 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +Generated by Emacs 25.2.50.5 (Org mode 8.2.10) from 0.12.2 (2017-08-29 02:08:58)
+Generated by Emacs 26.1 (Org mode 9.1.9) from 0.13.0 (2018-05-13 16:12:51)
Expanding snippets - - + @@ -92,7 +184,7 @@ @licstart The following is the entire license notice for the JavaScript code in this tag. -Copyright (C) 2012-2013 Free Software Foundation, Inc. +Copyright (C) 2012-2018 Free Software Foundation, Inc. The JavaScript code in this tag is free software: you can redistribute it and/or modify it under the terms of the GNU @@ -141,10 +233,10 @@ for the JavaScript code in this tag.Overview Intro and Tutorial - Snippet - +
- Snippet +
@@ -159,34 +251,34 @@ for the JavaScript code in this tag.
- Organization -
- Expansion +
- Expansion
- Development
- Menu
Table of Contents
-
- Triggering expansion +
- Triggering expansion
-- Controlling expansion +
- Controlling expansion
-
@@ -203,9 +295,9 @@ Maybe, you'll want some snippets to be expanded in a particular mode, or only under certain conditions, or be prompted using -- Eligible snippets
-- The condition system
-- Multiples snippet with the same key +
- Eligible snippets
+- The condition system
+- Multiples snippet with the same key
-Triggering expansion
-++Triggering expansion
+-You can use YASnippet to expand snippets in different ways:
@@ -214,36 +306,28 @@ You can use YASnippet to expand snippets in different ways:- When
-yas-minor-mode
is active:
- Type the snippet's trigger key then calling
+(bound toyas-expand
- (bound toTAB
by default). -TAB
by default).- Use the snippet's keybinding. -
+- Use the snippet's keybinding.
-- By expanding directly from the "YASnippet" menu in the menu-bar -
+- By expanding directly from the "YASnippet" menu in the menu-bar
-- Using hippie-expand -
- - +- Using hippie-expand
+ -- Call
+yas-insert-snippet
(useM-x yas-insert-snippet=
or its -keybindingC-c & C-s
). -- Call
yas-insert-snippet
(useM-x yas-insert-snippet
or its +keybindingC-c & C-s
).- Use m2m's excellent auto-complete -TODO: example for this -
+TODO: example for this -- Expanding from emacs-lisp code -
+- Expanding from emacs-lisp code
-Trigger key
-++Trigger key
+
yas-expand
tries to expand a snippet abbrev (also known as snippet key) before point. YASnippet also provides a conditional @@ -261,7 +345,6 @@ and<tab>
by default, however, you can freely remove those bi-(define-key yas-minor-mode-map (kbd "<tab>") nil) (define-key yas-minor-mode-map (kbd "TAB") nil)@@ -272,7 +355,6 @@ And set your own:--;; Bind `SPC' to `yas-expand' when snippet expansion available (it ;; will still call `self-insert-command' otherwise). (define-key yas-minor-mode-map (kbd "SPC") yas-maybe-expand) @@ -301,9 +383,9 @@ argument in the buffer's mode hook.-Fallback behaviour
-++-Fallback behaviour
+YASnippet used to support a more complicated way of sharing keybindings before
yas-maybe-expand
was added. This is now @@ -313,11 +395,11 @@ obsolete.-Insert at point
-++Insert at point
+--The command
yas-insert-snippet
lets you insert snippets at point +The commandyas-insert-snippet
lets you insert snippets at point for your current major mode. It prompts you for the snippet key first, and then for a snippet template if more than one template exists for the same key. @@ -335,14 +417,14 @@ The prompting methods used are again controlled by-Inserting region or register contents into snippet
-++-Inserting region or register contents into snippet
+It's often useful to inject already written text in the middle of a snippet. The variable
@@ -356,9 +438,9 @@ compatibility, but is now entirely equivalent toyas-wrap-around-region
when to t substitute the region contents into the$0
placeholder of a snippet expanded by -yas-insert-snippet
. Setting it to a character value (e.g.?0
) +yas-insert-snippet
. Setting it to a character value (e.g.?0
) will insert the contents of corresponding register.?0
.-Snippet keybinding
-++-Snippet keybinding
+See the section of the
# binding:
directive in Writing Snippets. @@ -366,18 +448,18 @@ See the section of the# binding:
directive in-Expanding from the menu
-++-Expanding from the menu
+See the YASnippet Menu.
-Expanding with
-hippie-expand
++-Expanding with
+hippie-expand
To integrate with
hippie-expand
, just putyas-hippie-try-expand
in @@ -388,9 +470,9 @@ prefer.-Expanding from emacs-lisp code
-++Expanding from emacs-lisp code
+Sometimes you might want to expand a snippet directly from your own elisp code. You should call
yas-expand-snippet
instead of @@ -407,7 +489,6 @@ menu has the same effect of evaluating the follow code:-@@ -420,12 +501,13 @@ See the internal documentation on -(yas-expand-snippet template)Controlling expansion
---Eligible snippets
-++Controlling expansion
++++-Eligible snippets
+YASnippet does quite a bit of filtering to find out which snippets are eligible for expanding at the current cursor position. @@ -436,46 +518,49 @@ In particular, the following things matter:
-
- Currently loaded snippets tables +
- + -
+Currently loaded snippets tables +
These are loaded from a directory hierarchy in your file system. See Organizing Snippets. They are named after major modes like
-html-mode
,ruby-mode
, etc… -- Major mode of the current buffer +
- + -
+Major mode of the current buffer +
If the currrent major mode matches one of the loaded snippet tables, then all that table's snippets are considered for expansion. Use
-M-x describe-variable RET major-mode RET
to find out which major mode you are in currently. -- Parent tables +
- + -
+Parent tables +
Snippet tables defined as the parent of some other eligible table are also considered. This works recursively, i.e. parents of parents of eligible tables are also considered. -
-- Buffer-local list of extra modes +
- +
+Buffer-local list of extra modes +
-Use
-yas-activate-extra-mode
to +Useyas-activate-extra-mode
to consider snippet tables whose name does not correspond to a major mode. Typically, you call this from a minor mode hook, for example: --;; When entering rinari-minor-mode, consider also the snippets in the ;; snippet table "rails-mode" (add-hook 'rinari-minor-mode-hook @@ -485,23 +570,24 @@ mode. Typically, you call this from a minor mode hook, for example:-
- Buffer-local
yas-buffer-local-condition
variable +- +
+Buffer-local
yas-buffer-local-condition
variable +This variable provides finer grained control over what snippets can be expanded in the current buffer. For example, the constant
-yas-not-string-or-comment-condition
has a value that disables -snippet expansion inside comments or string literals. See the +snippet expansion inside comments or string literals. See the condition system for more info. --The condition system
-++-The condition system
+Consider this scenario: you are an old Emacs hacker. You like the abbrev-way and bind
yas-expand
toSPC
. However, you don't want @@ -524,7 +610,6 @@ inside a comment? Set -(add-hook 'python-mode-hook (lambda () (setq yas-buffer-local-condition @@ -548,11 +633,11 @@ For the full set of possible conditions, see the documentation for-Multiples snippet with the same key
-++Multiples snippet with the same key
+--The rules outlined above can return more than +The rules outlined above can return more than one snippet to be expanded at point.
@@ -570,7 +655,6 @@ can put in your emacs-file:-@@ -580,9 +664,9 @@ Currently there are some alternatives solution with YASnippet.(setq yas-prompt-functions '(yas-x-prompt yas-dropdown-prompt))
-Use the X window system
-++Use the X window system
+-
@@ -597,20 +681,17 @@ means:
- It usually looks beautiful. E.g. when you compile Emacs with gtk -support, this menu will be rendered with your gtk theme. -
+support, this menu will be rendered with your gtk theme.- Your window system may or may not allow to you use
-C-n
,C-p
to -navigate this menu. -- This function can't be used when in a terminal. -
+navigate this menu. +- This function can't be used when in a terminal.
-Minibuffer prompting
-++Minibuffer prompting
+-
@@ -625,9 +706,9 @@ The best way is to try it. This works in a terminal.
-Use
-dropdown-menu.el
++Use
+dropdown-menu.el
-
@@ -647,9 +728,9 @@ shortcut to select the 6th candidate.
-Roll your own
-+-+@@ -178,17 +270,14 @@ In this menu, you can findRoll your own
+diff --git a/snippet-menu.html b/snippet-menu.html index d7c8db9..5fb0fff 100644 --- a/snippet-menu.html +++ b/snippet-menu.html @@ -3,21 +3,28 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +See the documentation on variable
@@ -659,7 +740,7 @@ See the documentation on variable -yas-prompt-functions
Generated by Emacs 25.2.50.5 (Org mode 8.2.10) from 0.12.2 (2017-08-29 02:08:58)
+Generated by Emacs 26.1 (Org mode 9.1.9) from 0.13.0 (2018-05-13 16:12:51)
YASnippet menu - - + @@ -92,7 +184,7 @@ @licstart The following is the entire license notice for the JavaScript code in this tag. -Copyright (C) 2012-2013 Free Software Foundation, Inc. +Copyright (C) 2012-2018 Free Software Foundation, Inc. The JavaScript code in this tag is free software: you can redistribute it and/or modify it under the terms of the GNU @@ -141,12 +233,12 @@ for the JavaScript code in this tag.- Overview
- Intro and Tutorial -
- Snippet -
+
- Snippet +
- Organization
- Expansion
- Development -
- Menu +
- Menu
- FAQ
- Reference @@ -159,11 +251,11 @@ for the JavaScript code in this tag.
Table of Contents
@@ -197,25 +286,25 @@ behavior.
- The currently loaded snippet definitions, organized by major mode, -and optional grouping. -
+and optional grouping.- A rundown of the most common commands, (followed by their keybindings) including commands to load directories and reload all -snippet definitions. -
+snippet definitions.- A series of submenus for customizing and exploring YASnippet -behavior. -
+behavior.-Loading snippets from menu
-++-Loading snippets from menu
+Invoking "Load snippets…" from the menu invokes
yas-load-directory
and prompts you for a snippet directory hierarchy to load.-Also useful is the "Reload everything" item to invoke
yas-reload-all
+Also useful is the "Reload everything" item to invokeyas-reload-all
which uncondionally reloads all the snippets directories defined inyas-snippet-dirs
and rebuilds the menus.-Snippet menu behavior
-++-Snippet menu behavior
+YASnippet will list in this section all the loaded snippet definitions organized by snippet table name. @@ -251,9 +340,9 @@ These customizations can also be found in the menu itself, under the
-Controlling indenting
-++-Controlling indenting
+The "Indenting" submenu contains options to control the values of
yas-indent-line
andyas-also-auto-indent-first-line
. See @@ -262,9 +351,9 @@ The "Indenting" submenu contains options to control the values of-Prompting method
-++-Prompting method
+The "Prompting method" submenu contains options to control the value of
yas-prompt-functions
. See Expanding snippets. @@ -272,9 +361,9 @@ The "Prompting method" submenu contains options to control the value of-Misc
-+-+Misc
+The "Misc" submenu contains options to control the values of more variables. @@ -283,7 +372,7 @@ variables.
-diff --git a/snippet-organization.html b/snippet-organization.html index 03ca816..b805085 100644 --- a/snippet-organization.html +++ b/snippet-organization.html @@ -3,21 +3,28 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +Generated by Emacs 25.2.50.5 (Org mode 8.2.10) from 0.12.2 (2017-08-29 02:08:58)
+Generated by Emacs 26.1 (Org mode 9.1.9) from 0.13.0 (2018-05-13 16:12:51)
Organizing snippets - - + @@ -92,7 +184,7 @@ @licstart The following is the entire license notice for the JavaScript code in this tag. -Copyright (C) 2012-2013 Free Software Foundation, Inc. +Copyright (C) 2012-2018 Free Software Foundation, Inc. The JavaScript code in this tag is free software: you can redistribute it and/or modify it under the terms of the GNU @@ -141,9 +233,9 @@ for the JavaScript code in this tag.- Overview
- Intro and Tutorial -
- Snippet -
-
- Organization +
- Snippet +
+
- Organization
- Expansion
- Development
- Menu @@ -159,23 +251,24 @@ for the JavaScript code in this tag.
Table of Contents
-
- Basic structure
-- Setting up
-yas-snippet-dirs
- The
-.yas-parents
file- TODO The
-.yas-make-groups
file- The
-.yas-setup.el
file- The
-.yas-compiled-snippet.el
file- The
+.yas-skip
file- Basic structure
+- Setting up
+yas-snippet-dirs
- The
+.yas-parents
file- TODO The
+.yas-make-groups
file- The
+.yas-setup.el
file- The
+.yas-compiled-snippet.el
file- The
.yas-skip
file-Basic structure
-++Basic structure
+--Snippet collections can be stored in plain text files. They are arranged by -sub-directories naming snippet tables. These mostly name Emacs major names. +Snippet collections can be stored in plain text files. They are +arranged by sub-directories naming snippet tables. These mostly +name Emacs major mode names.
@@ -197,9 +290,9 @@ triggering mechanism (see Expanding Snippets-Setting up
-yas-snippet-dirs
++Setting up
+yas-snippet-dirs
-The emacs variable
yas-snippet-dirs
tells YASnippet which collections to consider. It's used when you activate @@ -212,10 +305,8 @@ The default considers:-
- a personal collection that lives in
-~/.emacs.d/snippets
-- the bundled collection, taken as a relative path to
+yasnippet.el
localtion -- a personal collection that lives in
+~/.emacs.d/snippets
- the bundled collection, taken as a relative path to
yasnippet.el
localtion@@ -224,7 +315,6 @@ out:
-;; Develop in ~/emacs.d/mysnippets, but also ;; try out snippets in ~/Downloads/interesting-snippets (setq yas-snippet-dirs '("~/emacs.d/mysnippets" @@ -244,9 +334,9 @@ snippets in the first collection.-The
-.yas-parents
file++The
+.yas-parents
file-It's very useful to have certain modes share snippets between themselves. To do this, choose a mode subdirectory and place a @@ -274,13 +364,13 @@ mode.
-TODO The
-.yas-make-groups
file++-TODO The
+.yas-make-groups
fileIf you place an empty plain text file
@@ -318,9 +408,9 @@ Yet another way to create a nice snippet menu is to write into.yas-make-groups
inside one of the mode directories, the names of these sub-directories are -considered groups of snippets and the menu is organized much more +considered groups of snippets and the menu is organized much more cleanly:-The
-.yas-setup.el
file++-The
+.yas-setup.el
fileIf there is file named
.yas-setup.el
in a mode's snippet subdirectory, it is loaded along with the snippets. Utility @@ -329,9 +419,9 @@ functions used by the snippets can be put here.-The
-.yas-compiled-snippet.el
file++-The
+.yas-compiled-snippet.el
fileYou may compile a top-level snippet directory with the
yas-compile-directory
function, which will create a @@ -347,9 +437,9 @@ Alternatively, you may compile all directories in the list--The
-.yas-skip
file+@@ -159,426 +251,139 @@ for the JavaScript code in this tag.+The
+.yas-skip
fileA
.yas-skip
file in a mode's snippet subdirectory tells YASnippet not to load snippets from there. @@ -358,7 +448,7 @@ not to load snippets from there.-diff --git a/snippet-reference.html b/snippet-reference.html index 926d784..e0c8349 100644 --- a/snippet-reference.html +++ b/snippet-reference.html @@ -3,21 +3,28 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +Generated by Emacs 25.2.50.5 (Org mode 8.2.10) from 0.12.2 (2017-08-29 02:08:58)
+Generated by Emacs 26.1 (Org mode 9.1.9) from 0.13.0 (2018-05-13 16:12:51)
Reference - - + @@ -92,7 +184,7 @@ @licstart The following is the entire license notice for the JavaScript code in this tag. -Copyright (C) 2012-2013 Free Software Foundation, Inc. +Copyright (C) 2012-2018 Free Software Foundation, Inc. The JavaScript code in this tag is free software: you can redistribute it and/or modify it under the terms of the GNU @@ -141,15 +233,15 @@ for the JavaScript code in this tag.- Overview
- Intro and Tutorial -
- Snippet -
Table of Contents
-
- Interactive functions +
- Interactive functions
--
- -
yas-abort-snippet
(&optionalsnippet
)- -
yas-visit-snippet-file
()- -
yas-describe-table-by-namehash
()- -
yas-load-snippet-buffer
(table
&optionalinteractive
)- -
yas-global-mode
(&optionalarg
)- -
yas-skip-and-clear-or-delete-char
(&optionalfield
)- -
yas-next-field
(&optionalarg
)- -
yas-insert-snippet
(&optionalno-condition
)- -
yas-activate-extra-mode
(mode
)- -
yas-recompile-all
()- -
yas-compile-directory
(top-level-dir
)- -
yas-direct-keymaps-reload
()- -
yas-exit-all-snippets
()- -
yas-tryout-snippet
(&optionaldebug
)- -
yas-exit-snippet
(snippet
)- -
yas-expand
(&optionalfield
)- -
yas-expand-from-keymap
()- -
yas-minor-mode
(&optionalarg
)- -
yas-minor-mode-on
()- -
yas-reload-all
(&optionalno-jit
interactive
)- -
yas-load-directory
(top-level-dir
&optionaluse-jit
interactive
)- -
yas-new-snippet
(&optionalno-template
)- -
yas-load-snippet-buffer-and-close
(table
&optionalkill
)- -
yas-describe-tables
(&optionalwith-nonactive
)- -
yas-deactivate-extra-mode
(mode
)- -
yas-next-field-or-maybe-expand
()- -
yas-about
()- -
yas-prev-field
()- +
yas-expand-from-trigger-key
(&optionalfield
)- +
yas-load-snippet-buffer-and-close
(table
&optionalkill
)- +
yas-expand-from-trigger-key
(&optionalfield
)- +
yas-skip-and-clear-or-delete-char
(&optionalfield
)- +
yas-global-mode
(&optionalarg
)- +
yas-recompile-all
()- +
yas-visit-snippet-file
()- +
yas-deactivate-extra-mode
(mode
)- +
yas-prev-field
()- +
yas-load-snippet-buffer
(table
&optionalinteractive
)- +
yas-exit-all-snippets
()- +
yas-next-field
(&optionalarg
)- +
yas-abort-snippet
(&optionalsnippet
)- +
yas-describe-tables
(&optionalwith-nonactive
)- +
yas-expand-from-keymap
()- +
yas-new-snippet
(&optionalno-template
)- +
yas-reload-all
(&optionalno-jit
interactive
)- +
yas-next-field-or-maybe-expand
()- +
yas-activate-extra-mode
(mode
)- +
yas-insert-snippet
(&optionalno-condition
)- +
yas-expand
(&optionalfield
)- +
yas-minor-mode
(&optionalarg
)- +
yas-direct-keymaps-reload
()- +
yas-exit-snippet
(snippet
)- +
yas-about
()- +
yas-minor-mode-on
()- +
yas-skip-and-clear-field
(&optionalfield
)- +
yas-compile-directory
(top-level-dir
)- +
yas-load-directory
(top-level-dir
&optionaluse-jit
interactive
)- +
yas-describe-table-by-namehash
()yas-tryout-snippet
(&optionaldebug
)- Customization variables +
- Customization variables
--
- -
yas-choose-tables-first
- -
yas-snippet-revival
- -
yas-overlay-priority
- -
yas-alias-to-yas/prefix-p
- -
yas-also-auto-indent-first-line
- -
yas-new-snippet-default
- -
yas-choose-keys-first
- -
yas-buffer-local-condition
- -
yas-also-indent-empty-lines
- -
yas-wrap-around-region
- -
yas-prompt-functions
- -
yas-visit-from-menu
- -
yas-triggers-in-field
- -
yas-trigger-symbol
- -
yas-use-menu
- -
yas-indent-line
- -
yas-expand-only-for-last-commands
- -
yas-snippet-dirs
()- +
yas-good-grace
- +
yas-expand-only-for-last-commands
- +
yas-wrap-around-region
- +
yas-new-snippet-default
- +
yas-choose-keys-first
- +
yas-triggers-in-field
- +
yas-use-menu
- +
yas-snippet-dirs
()- +
yas-buffer-local-condition
- +
yas-choose-tables-first
- +
yas-overlay-priority
- +
yas-snippet-revival
- +
yas-good-grace
- +
yas-visit-from-menu
- +
yas-prompt-functions
- +
yas-trigger-symbol
- +
yas-also-indent-empty-lines
- +
yas-also-auto-indent-first-line
- +
yas-indent-line
yas-alias-to-yas/prefix-p
- Useful functions +
- Useful functions
--
- -
yas-default-from-field
(number
)- -
yas-completing-prompt
(prompt
choices
&optionaldisplay-fn
completion-fn
)- -
yas-selected-text
()- -
yas-hippie-try-expand
(first-time?
)- -
yas-snippet-mode-buffer-p
()- -
yas-global-mode-cmhh
()- -
yas-lookup-snippet
(name
&optionalmode
noerror
)- -
yas-throw
(text
)- -
yas-inside-string
()- -
yas-next-field-will-exit-p
(&optionalarg
)- -
yas-x-prompt
(prompt
choices
&optionaldisplay-fn
)- -
yas-shortest-key-until-whitespace
(_start-point
)- -
yas-maybe-load-snippet-buffer
()- -
yas-longest-key-from-whitespace
(start-point
)- -
yas-text
()- -
yas-ido-prompt
(prompt
choices
&optionaldisplay-fn
)- -
yas-try-key-from-whitespace
(_start-point
)- -
yas-maybe-ido-prompt
(prompt
choices
&optionaldisplay-fn
)- -
yas-dropdown-prompt
(_prompt
choices
&optionaldisplay-fn
)- -
yas-define-snippets
(mode
snippets
)- -
yas-global-mode-enable-in-buffers
()- -
yas-no-prompt
(_prompt
choices
&optional_display-fn
)- -
yas-active-keys
()- -
yas-define-condition-cache
(func
doc
&restbody
)- -
yas-global-mode-check-buffers
()- -
yas-define-menu
(mode
menu
&optionalomit-items
)- -
yas-field-value
(number
)- -
yas-verify-value
(possibilities
)- -
yas-key-to-value
(alist
)- -
yas-escape-text
(text
)- -
yas-choose-value
(&restpossibilities
)- -
yas-substr
(str
pattern
&optionalsubexp
)- -
yas-active-snippets
(&optionalbeg
end
)- -
yas-unimplemented
(&optionalmissing-feature
)- -
yas-expand-snippet
(content
&optionalstart
end
expand-env
)- +
yas-minor-mode-set-explicitly
()- +
yas-expand-snippet
(snippet
&optionalstart
end
expand-env
)- +
yas-define-snippets
(mode
snippets
)- +
yas-completing-prompt
(prompt
choices
&optionaldisplay-fn
completion-fn
)- +
yas-inside-string
()- +
yas-lookup-snippet
(name
&optionalmode
noerror
)- +
yas-x-prompt
(prompt
choices
&optionaldisplay-fn
)- +
yas-global-mode-enable-in-buffers
()- +
yas-selected-text
()- +
yas-field-value
(number
)- +
yas-global-mode-cmhh
()- +
yas-escape-text
(text
)- +
yas-dropdown-prompt
(_prompt
choices
&optionaldisplay-fn
)- +
yas-shortest-key-until-whitespace
(_start-point
)- +
yas-substr
(str
pattern
&optionalsubexp
)- +
yas-ido-prompt
(prompt
choices
&optionaldisplay-fn
)- +
yas-maybe-ido-prompt
(prompt
choices
&optionaldisplay-fn
)- +
yas-snippet-mode-buffer-p
()- +
yas-no-prompt
(_prompt
choices
&optional_display-fn
)- +
yas-longest-key-from-whitespace
(start-point
)- +
yas-try-key-from-whitespace
(_start-point
)- +
yas-choose-value
(&restpossibilities
)- +
yas-global-mode-check-buffers
()- +
yas-minor-mode-set-explicitly
()- +
yas-define-menu
(mode
menu
&optionalomit-items
)- +
yas-current-field
()- +
yas-unimplemented
(&optionalmissing-feature
)- +
yas-define-condition-cache
(func
doc
&restbody
)- +
yas-active-keys
()- +
yas-text
()- +
yas-next-field-will-exit-p
(&optionalarg
)- +
yas-active-snippets
(&optionalbeg
end
)- +
yas-verify-value
(possibilities
)- +
yas-default-from-field
(number
)- +
yas-key-to-value
(alist
)- +
yas-throw
(text
)- +
yas-hippie-try-expand
(first-time?
)yas-maybe-load-snippet-buffer
()- Useful variables +
- Useful variables
-
- -
yas-global-mode-buffers
- -
yas-after-reload-hook
- -
yas-snippet-beg
- -
yas-maybe-expand
- -
yas-after-exit-snippet-hook
- -
yas-global-mode-hook
- -
yas-minor-mode-map
- -
yas-moving-away-p
- -
yas-modified-p
- -
yas-before-expand-snippet-hook
- -
yas-keymap
- -
yas-key-syntaxes
- -
yas-snippet-end
- -
yas-not-string-or-comment-condition
- -
yas-dont-activate-functions
- -
yas-minor-mode-hook
- -
yas-verbosity
- -
yas-minor-mode-major-mode
- -
yas-installed-snippets-dir
- +
yas-maybe-expand-from-keymap
- +
yas-key-syntaxes
- +
yas-modified-p
- +
yas-dont-activate-functions
- +
yas-before-expand-snippet-hook
- +
yas-maybe-skip-and-clear-field
- +
yas-keymap
- +
yas-verbosity
- +
yas-minor-mode-hook
- +
yas-minor-mode-major-mode
- +
yas-not-string-or-comment-condition
- +
yas-after-exit-snippet-hook
- +
yas-maybe-expand
- +
yas-after-reload-hook
- +
yas-new-snippet-buffer-name
- +
yas-snippet-end
- +
yas-minor-mode-map
- +
yas-global-mode-hook
- +
yas-snippet-beg
- +
yas-moving-away-p
- +
yas-maybe-expand-from-keymap
yas-global-mode-buffers
-Interactive functions
----
yas-abort-snippet
(&optionalsnippet
)--warning: no doc for symbol
+yas-abort-snippet
-+- -Interactive functions
+--- - - --
yas-visit-snippet-file
()---Choose a snippet to edit, selection like
- -yas-insert-snippet
. --Only success if selected snippet was loaded from a file. Put the -visited file in
-snippet-mode
. --- --
yas-load-snippet-buffer
(table
&optionalinteractive
)---Parse and load current buffer's snippet definition into
-table
. -table
is a symbol name passed toyas--table-get-create
. When -called interactively, prompt for the table name. -Return theyas--template
object created --- --
yas-global-mode
(&optionalarg
)---Toggle Yas minor mode in all buffers. -With prefix
- -arg
, enable Yas-Global mode ifarg
is positive; -otherwise, disable it. If called from Lisp, enable the mode if -arg
is omitted or nil. --Yas minor mode is enabled in all buffers where -
-yas-minor-mode-on
would do it. -Seeyas-minor-mode
for more information on Yas minor mode. --- --
yas-skip-and-clear-or-delete-char
(&optionalfield
)---Clears unmodified field if at field start, skips to next tab. -
- --Otherwise deletes a character normally by calling
-delete-char
. --- --
yas-next-field
(&optionalarg
)---Navigate to the
- -arg
th next field. --If there's none, exit the snippet. -
--- --
yas-insert-snippet
(&optionalno-condition
)---Choose a snippet to expand, pop-up a list of choices according -to
- -yas-prompt-functions
. --With prefix argument
-no-condition
, bypass filtering of snippets -by condition. --- --
yas-activate-extra-mode
(mode
)---Activates the snippets for the given
- -mode
in the buffer. --The function can be called in the hook of a minor mode to -activate snippets associated with that mode. -
--- --
yas-recompile-all
()---Compile every dir in
-yas-snippet-dirs
. --- --
yas-compile-directory
(top-level-dir
)---Create .yas-compiled-snippets.el files under subdirs of
- -top-level-dir
. --This works by stubbing a few functions, then calling -
-yas-load-directory
. --- - - --
yas-direct-keymaps-reload
()---Force reload the direct keybinding for active snippet tables. -
--- - - --
yas-tryout-snippet
(&optionaldebug
)---Test current buffer's snippet template in other buffer. -
--- --
yas-expand
(&optionalfield
)---Expand a snippet before point. If no snippet -expansion is possible, defer to
- -yas-fallback-behavior
(which see). --Optional argument
-field
is for non-interactive use and is an -object satisfyingyas--field-p
to restrict the expansion to. --- - --
yas-expand-from-keymap
()---Expand/run snippets from keymaps, possibly falling back to original binding. -
--- --
yas-minor-mode
(&optionalarg
)---Toggle YASnippet mode. -
- --When YASnippet mode is enabled,
- -yas-expand
, normally bound to -the tab key, expands snippets of code depending on the major -mode. --With no argument, this command toggles the mode. -positive prefix argument turns on the mode. -Negative prefix argument turns off the mode. -
- --Key bindings: -\{yas-minor-mode-map} -
--- --
yas-minor-mode-on
()---Turn on YASnippet minor mode. -
- --Honour
-yas-dont-activate-functions
, which see. --- --
yas-reload-all
(&optionalno-jit
interactive
)---Reload all snippets and rebuild the YASnippet menu. -
- --When
- -no-jit
is non-nil force immediate reload of all known -snippets underyas-snippet-dirs
, otherwise use just-in-time -loading. --When called interactively, use just-in-time loading when given a -prefix argument. -
--- --
yas-load-directory
(top-level-dir
&optionaluse-jit
interactive
)---Load snippets in directory hierarchy
- -top-level-dir
. --Below
- -top-level-dir
each directory should be a mode name. --With prefix argument
-use-jit
do jit-loading of snippets. --- --
yas-new-snippet
(&optionalno-template
)---Pops a new buffer for writing a snippet. -
- --Expands a snippet-writing snippet, unless the optional prefix arg -
-no-template
is non-nil. --+
yas-load-snippet-buffer-and-close
(table
&optionalkill
)+- - -
yas-load-snippet-buffer-and-close
(table
&optionalkill
)Load and save the snippet, then
quit-window
if saved. @@ -598,57 +403,8 @@ andkill-buffer
instead.-- --
yas-deactivate-extra-mode
(mode
)---Deactivates the snippets for the given
-mode
in the buffer. --- - - - - - --
yas-next-field-or-maybe-expand
()---Try to expand a snippet at a key before point. -
- --Otherwise delegate to
-yas-next-field
. --Customization variables
----
yas-choose-tables-first
+ ++-+
yas-skip-and-clear-or-delete-char
(&optionalfield
)-If non-nil, and multiple eligible snippet tables, prompts user for tables first. +Clears unmodified field if at field start, skips to next tab.
-Otherwise, user chooses between the merging together of all -eligible tables. -
- --This affects
yas-insert-snippet
,yas-visit-snippet-file
+Otherwise deletes a character normally by callingdelete-char
.--
yas-snippet-revival
++-+
yas-global-mode
(&optionalarg
)-Non-nil means re-activate snippet fields after undo/redo. +Toggle Yas minor mode in all buffers. +With prefix
+ +arg
, enable Yas-Global mode ifarg
is positive; +otherwise, disable it. If called from Lisp, enable the mode if +arg
is omitted or nil. ++Yas minor mode is enabled in all buffers where +
yas-minor-mode-on
would do it. +Seeyas-minor-mode
for more information on Yas minor mode.--
yas-overlay-priority
++-+
yas-recompile-all
()-Priority to use for yasnippets overlays. -This is useful to control whether snippet navigation bindings -override bindings from other packages (e.g.,
company-mode
). +Compile every dir inyas-snippet-dirs
.--
yas-alias-to-yas/prefix-p
++-+
yas-visit-snippet-file
()-If non-nil make aliases for the old style yas/ prefixed symbols. -It must be set to nil before loading yasnippet to take effect. +Choose a snippet to edit, selection like
+ +yas-insert-snippet
. ++Only success if selected snippet was loaded from a file. Put the +visited file in
snippet-mode
.--
yas-also-auto-indent-first-line
++-+
yas-deactivate-extra-mode
(mode
)-Non-nil means also auto indent first line according to mode. -
- --Naturally this is only valid when
yas-indent-line
isauto
. +Deactivates the snippets for the givenmode
in the buffer.--
yas-new-snippet-default
++-+
yas-prev-field
()-Default snippet to use when creating a new snippet. -If nil, don't use any snippet. +Navigate to prev field. If there's none, exit the snippet.
--
yas-choose-keys-first
++-+
yas-load-snippet-buffer
(table
&optionalinteractive
)-If non-nil, prompt for snippet key first, then for template. -
- --Otherwise prompts for all possible snippet names. -
- --This affects
yas-insert-snippet
andyas-visit-snippet-file
. +Parse and load current buffer's snippet definition intotable
. +table
is a symbol name passed toyas--table-get-create
. When +called interactively, prompt for the table name. +Return theyas--template
object created--
yas-buffer-local-condition
++-+
yas-exit-all-snippets
()-Snippet expanding condition. -
- --This variable is a Lisp form which is evaluated every time a -snippet expansion is attempted: -
- --
- -- If it evaluates to nil, no snippets can be expanded. -
- -- If it evaluates to the a cons (require-snippet-condition -. requirement) - -
- --
-- Snippets bearing no "# condition:" directive are not -considered -
- -- Snippets bearing conditions that evaluate to nil (or -produce an error) won't be considered. -
- -- If the snippet has a condition that evaluates to non-nil -result: - -
--
-- If requirement is t, the snippet is considered -
- -- If requirement is
- -eq
result, the snippet is -considered -- Otherwise, the snippet is not considered. -
-- If it evaluates to the symbol
- -always
, all snippets are -considered for expansion, regardless of any conditions. -- If it evaluates to t or some other non-nil value - -
--
-- Snippet bearing no conditions, or conditions that -evaluate to non-nil, are considered for expansion. -
- -- Otherwise, the snippet is not considered. -
--Here's an example preventing snippets from being expanded from -inside comments, in
- -python-mode
only, with the exception of -snippets returning the symbolforce-in-comment
in their -conditions. --(add-hook \='python-mode-hook - (lambda () - (setq yas-buffer-local-condition - \='(if (python-syntax-comment-or-string-p) - \='(require-snippet-condition . force-in-comment) - t)))) +Exit all snippets.
--
yas-also-indent-empty-lines
++-+
yas-next-field
(&optionalarg
)-Non-nil means also indent empty lines according to mode. +Navigate to the
+ +arg
th next field. ++If there's none, exit the snippet.
--
yas-wrap-around-region
++-+
yas-abort-snippet
(&optionalsnippet
)-What to insert for snippet's $0 field. -
- --If set to a character, insert contents of corresponding register. -If non-nil insert region contents. This can be overridden on a -per-snippet basis. A value of
cua
is considered equivalent to -`?0' for backwards compatibility. +warning: no doc for symbolyas-abort-snippet
--
yas-prompt-functions
++-+
yas-describe-tables
(&optionalwith-nonactive
)-Functions to prompt for keys, templates, etc interactively. -
- --These functions are called with the following arguments: -
- --
-- prompt: A string to prompt the user -
- -- choices: a list of strings or objects. -
- -- optional display-fn : A function that, when applied to each of -
--the objects in choices will return a string. -
- --The return value of any function you put here should be one of -the objects in choices, properly formatted with display-fn (if -that is passed). -
- --
-- To signal that your particular style of prompting is -
--unavailable at the moment, you can also have the function return -nil. -
- --
-- To signal that the user quit the prompting process, you can -
--signal
- -quit
with --(signal \='quit "user quit!"). +Display snippets for each table.