mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-02-04 06:32:24 +00:00
Automatic documentation update.
From 0.13.0
This commit is contained in:
@@ -3,21 +3,28 @@
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Expanding snippets</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="Org-mode" />
|
||||
<meta name="generator" content="Org mode" />
|
||||
<style type="text/css">
|
||||
<!--/*--><![CDATA[/*><!--*/
|
||||
.title { text-align: center; }
|
||||
.title { text-align: center;
|
||||
margin-bottom: .2em; }
|
||||
.subtitle { text-align: center;
|
||||
font-size: medium;
|
||||
font-weight: bold;
|
||||
margin-top:0; }
|
||||
.todo { font-family: monospace; color: red; }
|
||||
.done { color: green; }
|
||||
.done { font-family: monospace; color: green; }
|
||||
.priority { font-family: monospace; color: orange; }
|
||||
.tag { background-color: #eee; font-family: monospace;
|
||||
padding: 2px; font-size: 80%; font-weight: normal; }
|
||||
.timestamp { color: #bebebe; }
|
||||
.timestamp-kwd { color: #5f9ea0; }
|
||||
.right { margin-left: auto; margin-right: 0px; text-align: right; }
|
||||
.left { margin-left: 0px; margin-right: auto; text-align: left; }
|
||||
.center { margin-left: auto; margin-right: auto; text-align: center; }
|
||||
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
|
||||
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
|
||||
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
|
||||
.underline { text-decoration: underline; }
|
||||
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
||||
p.verse { margin-left: 3%; }
|
||||
@@ -44,27 +51,111 @@
|
||||
border: 1px solid black;
|
||||
}
|
||||
pre.src:hover:before { display: inline;}
|
||||
pre.src-sh:before { content: 'sh'; }
|
||||
pre.src-bash:before { content: 'sh'; }
|
||||
/* Languages per Org manual */
|
||||
pre.src-asymptote:before { content: 'Asymptote'; }
|
||||
pre.src-awk:before { content: 'Awk'; }
|
||||
pre.src-C:before { content: 'C'; }
|
||||
/* pre.src-C++ doesn't work in CSS */
|
||||
pre.src-clojure:before { content: 'Clojure'; }
|
||||
pre.src-css:before { content: 'CSS'; }
|
||||
pre.src-D:before { content: 'D'; }
|
||||
pre.src-ditaa:before { content: 'ditaa'; }
|
||||
pre.src-dot:before { content: 'Graphviz'; }
|
||||
pre.src-calc:before { content: 'Emacs Calc'; }
|
||||
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
||||
pre.src-R:before { content: 'R'; }
|
||||
pre.src-perl:before { content: 'Perl'; }
|
||||
pre.src-java:before { content: 'Java'; }
|
||||
pre.src-sql:before { content: 'SQL'; }
|
||||
pre.src-fortran:before { content: 'Fortran'; }
|
||||
pre.src-gnuplot:before { content: 'gnuplot'; }
|
||||
pre.src-haskell:before { content: 'Haskell'; }
|
||||
pre.src-hledger:before { content: 'hledger'; }
|
||||
pre.src-java:before { content: 'Java'; }
|
||||
pre.src-js:before { content: 'Javascript'; }
|
||||
pre.src-latex:before { content: 'LaTeX'; }
|
||||
pre.src-ledger:before { content: 'Ledger'; }
|
||||
pre.src-lisp:before { content: 'Lisp'; }
|
||||
pre.src-lilypond:before { content: 'Lilypond'; }
|
||||
pre.src-lua:before { content: 'Lua'; }
|
||||
pre.src-matlab:before { content: 'MATLAB'; }
|
||||
pre.src-mscgen:before { content: 'Mscgen'; }
|
||||
pre.src-ocaml:before { content: 'Objective Caml'; }
|
||||
pre.src-octave:before { content: 'Octave'; }
|
||||
pre.src-org:before { content: 'Org mode'; }
|
||||
pre.src-oz:before { content: 'OZ'; }
|
||||
pre.src-plantuml:before { content: 'Plantuml'; }
|
||||
pre.src-processing:before { content: 'Processing.js'; }
|
||||
pre.src-python:before { content: 'Python'; }
|
||||
pre.src-R:before { content: 'R'; }
|
||||
pre.src-ruby:before { content: 'Ruby'; }
|
||||
pre.src-sass:before { content: 'Sass'; }
|
||||
pre.src-scheme:before { content: 'Scheme'; }
|
||||
pre.src-screen:before { content: 'Gnu Screen'; }
|
||||
pre.src-sed:before { content: 'Sed'; }
|
||||
pre.src-sh:before { content: 'shell'; }
|
||||
pre.src-sql:before { content: 'SQL'; }
|
||||
pre.src-sqlite:before { content: 'SQLite'; }
|
||||
/* additional languages in org.el's org-babel-load-languages alist */
|
||||
pre.src-forth:before { content: 'Forth'; }
|
||||
pre.src-io:before { content: 'IO'; }
|
||||
pre.src-J:before { content: 'J'; }
|
||||
pre.src-makefile:before { content: 'Makefile'; }
|
||||
pre.src-maxima:before { content: 'Maxima'; }
|
||||
pre.src-perl:before { content: 'Perl'; }
|
||||
pre.src-picolisp:before { content: 'Pico Lisp'; }
|
||||
pre.src-scala:before { content: 'Scala'; }
|
||||
pre.src-shell:before { content: 'Shell Script'; }
|
||||
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
|
||||
/* additional language identifiers per "defun org-babel-execute"
|
||||
in ob-*.el */
|
||||
pre.src-cpp:before { content: 'C++'; }
|
||||
pre.src-abc:before { content: 'ABC'; }
|
||||
pre.src-coq:before { content: 'Coq'; }
|
||||
pre.src-groovy:before { content: 'Groovy'; }
|
||||
/* additional language identifiers from org-babel-shell-names in
|
||||
ob-shell.el: ob-shell is the only babel language using a lambda to put
|
||||
the execution function name together. */
|
||||
pre.src-bash:before { content: 'bash'; }
|
||||
pre.src-csh:before { content: 'csh'; }
|
||||
pre.src-ash:before { content: 'ash'; }
|
||||
pre.src-dash:before { content: 'dash'; }
|
||||
pre.src-ksh:before { content: 'ksh'; }
|
||||
pre.src-mksh:before { content: 'mksh'; }
|
||||
pre.src-posh:before { content: 'posh'; }
|
||||
/* Additional Emacs modes also supported by the LaTeX listings package */
|
||||
pre.src-ada:before { content: 'Ada'; }
|
||||
pre.src-asm:before { content: 'Assembler'; }
|
||||
pre.src-caml:before { content: 'Caml'; }
|
||||
pre.src-delphi:before { content: 'Delphi'; }
|
||||
pre.src-html:before { content: 'HTML'; }
|
||||
pre.src-idl:before { content: 'IDL'; }
|
||||
pre.src-mercury:before { content: 'Mercury'; }
|
||||
pre.src-metapost:before { content: 'MetaPost'; }
|
||||
pre.src-modula-2:before { content: 'Modula-2'; }
|
||||
pre.src-pascal:before { content: 'Pascal'; }
|
||||
pre.src-ps:before { content: 'PostScript'; }
|
||||
pre.src-prolog:before { content: 'Prolog'; }
|
||||
pre.src-simula:before { content: 'Simula'; }
|
||||
pre.src-tcl:before { content: 'tcl'; }
|
||||
pre.src-tex:before { content: 'TeX'; }
|
||||
pre.src-plain-tex:before { content: 'Plain TeX'; }
|
||||
pre.src-verilog:before { content: 'Verilog'; }
|
||||
pre.src-vhdl:before { content: 'VHDL'; }
|
||||
pre.src-xml:before { content: 'XML'; }
|
||||
pre.src-nxml:before { content: 'XML'; }
|
||||
/* add a generic configuration mode; LaTeX export needs an additional
|
||||
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
|
||||
pre.src-conf:before { content: 'Configuration File'; }
|
||||
|
||||
table { border-collapse:collapse; }
|
||||
caption.t-above { caption-side: top; }
|
||||
caption.t-bottom { caption-side: bottom; }
|
||||
td, th { vertical-align:top; }
|
||||
th.right { text-align: center; }
|
||||
th.left { text-align: center; }
|
||||
th.center { text-align: center; }
|
||||
td.right { text-align: right; }
|
||||
td.left { text-align: left; }
|
||||
td.center { text-align: center; }
|
||||
th.org-right { text-align: center; }
|
||||
th.org-left { text-align: center; }
|
||||
th.org-center { text-align: center; }
|
||||
td.org-right { text-align: right; }
|
||||
td.org-left { text-align: left; }
|
||||
td.org-center { text-align: center; }
|
||||
dt { font-weight: bold; }
|
||||
.footpara:nth-child(2) { display: inline; }
|
||||
.footpara { display: block; }
|
||||
.footpara { display: inline; }
|
||||
.footdef { margin-bottom: 1em; }
|
||||
.figure { padding: 1em; }
|
||||
.figure p { text-align: center; }
|
||||
@@ -84,6 +175,7 @@
|
||||
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
|
||||
.org-info-js_search-highlight
|
||||
{ background-color: #ffff00; color: #000000; font-weight: bold; }
|
||||
.org-svg { width: 90%; }
|
||||
/*]]>*/-->
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||
@@ -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.
|
||||
<li> <a href="index.html">Overview</a>
|
||||
<li> <a href="https://github.com/joaotavora/yasnippet/blob/master/README.mdown">
|
||||
Intro and Tutorial</a>
|
||||
<li class="center">Snippet
|
||||
<ul>
|
||||
<li class="center border">Snippet
|
||||
<ul class="nopad">
|
||||
<li> <a href="snippet-organization.html">Organization</a>
|
||||
<li> <a href="snippet-expansion.html">Expansion</a>
|
||||
<li> <span class='current'>Expansion</span>
|
||||
<li> <a href="snippet-development.html">Development</a>
|
||||
<li> <a href="snippet-menu.html">Menu</a>
|
||||
</ul>
|
||||
@@ -159,34 +251,34 @@ for the JavaScript code in this tag.
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#sec-1">Triggering expansion</a>
|
||||
<li><a href="#org12170ff">Triggering expansion</a>
|
||||
<ul>
|
||||
<li><a href="#sec-1-1">Trigger key</a>
|
||||
<li><a href="#org87a6f68">Trigger key</a>
|
||||
<ul>
|
||||
<li><a href="#sec-1-1-1">Fallback behaviour</a></li>
|
||||
<li><a href="#org161aff0">Fallback behaviour</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#sec-1-2">Insert at point</a>
|
||||
<li><a href="#org454e5fd">Insert at point</a>
|
||||
<ul>
|
||||
<li><a href="#sec-1-2-1">Inserting region or register contents into snippet</a></li>
|
||||
<li><a href="#org05cd89a">Inserting region or register contents into snippet</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#sec-1-3">Snippet keybinding</a></li>
|
||||
<li><a href="#sec-1-4">Expanding from the menu</a></li>
|
||||
<li><a href="#sec-1-5">Expanding with <code>hippie-expand</code></a></li>
|
||||
<li><a href="#sec-1-6">Expanding from emacs-lisp code</a></li>
|
||||
<li><a href="#orgc3c8799">Snippet keybinding</a></li>
|
||||
<li><a href="#orgf5cd066">Expanding from the menu</a></li>
|
||||
<li><a href="#orgaf084f4">Expanding with <code>hippie-expand</code></a></li>
|
||||
<li><a href="#orgb8b9e8f">Expanding from emacs-lisp code</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#sec-2">Controlling expansion</a>
|
||||
<li><a href="#org61654fd">Controlling expansion</a>
|
||||
<ul>
|
||||
<li><a href="#sec-2-1">Eligible snippets</a></li>
|
||||
<li><a href="#sec-2-2">The condition system </a></li>
|
||||
<li><a href="#sec-2-3">Multiples snippet with the same key</a>
|
||||
<li><a href="#orga555023">Eligible snippets</a></li>
|
||||
<li><a href="#org075c5ff">The condition system </a></li>
|
||||
<li><a href="#org2f6a9be">Multiples snippet with the same key</a>
|
||||
<ul>
|
||||
<li><a href="#sec-2-3-1">Use the X window system</a></li>
|
||||
<li><a href="#sec-2-3-2">Minibuffer prompting</a></li>
|
||||
<li><a href="#sec-2-3-3">Use <code>dropdown-menu.el</code></a></li>
|
||||
<li><a href="#sec-2-3-4">Roll your own</a></li>
|
||||
<li><a href="#org020d7e4">Use the X window system</a></li>
|
||||
<li><a href="#org8c16a13">Minibuffer prompting</a></li>
|
||||
<li><a href="#orgb151bf6">Use <code>dropdown-menu.el</code></a></li>
|
||||
<li><a href="#orgda9ea36">Roll your own</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -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
|
||||
</p>
|
||||
|
||||
<div id="outline-container-sec-1" class="outline-2">
|
||||
<h2 id="sec-1">Triggering expansion</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<div id="outline-container-org12170ff" class="outline-2">
|
||||
<h2 id="org12170ff">Triggering expansion</h2>
|
||||
<div class="outline-text-2" id="text-org12170ff">
|
||||
<p>
|
||||
You can use YASnippet to expand snippets in different ways:
|
||||
</p>
|
||||
@@ -214,36 +306,28 @@ You can use YASnippet to expand snippets in different ways:
|
||||
<li>When <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> is active:
|
||||
<ul class="org-ul">
|
||||
<li>Type the snippet's <b>trigger key</b> then calling <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a>
|
||||
(bound to <code>TAB</code> by default).
|
||||
</li>
|
||||
(bound to <code>TAB</code> by default).</li>
|
||||
|
||||
<li>Use the snippet's <b>keybinding</b>.
|
||||
</li>
|
||||
<li>Use the snippet's <b>keybinding</b>.</li>
|
||||
|
||||
<li>By expanding directly from the "YASnippet" menu in the menu-bar
|
||||
</li>
|
||||
<li>By expanding directly from the "YASnippet" menu in the menu-bar</li>
|
||||
|
||||
<li>Using hippie-expand
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Using hippie-expand</li>
|
||||
</ul></li>
|
||||
|
||||
<li>Call <a href="snippet-reference.html#yas-insert-snippet"><code>yas-insert-snippet</code></a> (use <code>M-x yas-insert-snippet=</code> or its
|
||||
keybinding <code>C-c & C-s</code>).
|
||||
</li>
|
||||
<li>Call <a href="snippet-reference.html#yas-insert-snippet"><code>yas-insert-snippet</code></a> (use <code>M-x yas-insert-snippet</code> or its
|
||||
keybinding <code>C-c & C-s</code>).</li>
|
||||
|
||||
<li>Use m2m's excellent auto-complete
|
||||
TODO: example for this
|
||||
</li>
|
||||
TODO: example for this</li>
|
||||
|
||||
<li>Expanding from emacs-lisp code
|
||||
</li>
|
||||
<li>Expanding from emacs-lisp code</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1-1" class="outline-3">
|
||||
<h3 id="sec-1-1">Trigger key</h3>
|
||||
<div class="outline-text-3" id="text-1-1">
|
||||
<div id="outline-container-org87a6f68" class="outline-3">
|
||||
<h3 id="org87a6f68">Trigger key</h3>
|
||||
<div class="outline-text-3" id="text-org87a6f68">
|
||||
<p>
|
||||
<a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> tries to expand a <i>snippet abbrev</i> (also known as
|
||||
<i>snippet key</i>) before point. YASnippet also provides a <i>conditional
|
||||
@@ -261,7 +345,6 @@ and <code><tab></code> by default, however, you can freely remove those bi
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp">(define-key yas-minor-mode-map (kbd <span class="org-string">"<tab>"</span>) nil)
|
||||
(define-key yas-minor-mode-map (kbd <span class="org-string">"TAB"</span>) nil)
|
||||
</pre>
|
||||
@@ -272,7 +355,6 @@ And set your own:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp"><span class="org-comment-delimiter">;; </span><span class="org-comment">Bind `</span><span class="org-comment"><span class="org-constant">SPC</span></span><span class="org-comment">' to `</span><span class="org-comment"><span class="org-constant">yas-expand</span></span><span class="org-comment">' when snippet expansion available (it</span>
|
||||
<span class="org-comment-delimiter">;; </span><span class="org-comment">will still call `</span><span class="org-comment"><span class="org-constant">self-insert-command</span></span><span class="org-comment">' otherwise).</span>
|
||||
(define-key yas-minor-mode-map (kbd <span class="org-string">"SPC"</span>) yas-maybe-expand)
|
||||
@@ -301,9 +383,9 @@ argument in the buffer's mode hook.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1-1-1" class="outline-4">
|
||||
<h4 id="sec-1-1-1">Fallback behaviour</h4>
|
||||
<div class="outline-text-4" id="text-1-1-1">
|
||||
<div id="outline-container-org161aff0" class="outline-4">
|
||||
<h4 id="org161aff0">Fallback behaviour</h4>
|
||||
<div class="outline-text-4" id="text-org161aff0">
|
||||
<p>
|
||||
YASnippet used to support a more complicated way of sharing
|
||||
keybindings before <a href="snippet-reference.html#yas-expand"><code>yas-maybe-expand</code></a> was added. This is now
|
||||
@@ -313,11 +395,11 @@ obsolete.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1-2" class="outline-3">
|
||||
<h3 id="sec-1-2">Insert at point</h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
<div id="outline-container-org454e5fd" class="outline-3">
|
||||
<h3 id="org454e5fd">Insert at point</h3>
|
||||
<div class="outline-text-3" id="text-org454e5fd">
|
||||
<p>
|
||||
The command <i><code>yas-insert-snippet</code></i> lets you insert snippets at point
|
||||
The command <a href="snippet-reference.html#yas-insert-snippet"><code>yas-insert-snippet</code></a> lets you insert snippets at point
|
||||
<i>for your current major mode</i>. 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
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1-2-1" class="outline-4">
|
||||
<h4 id="sec-1-2-1">Inserting region or register contents into snippet</h4>
|
||||
<div class="outline-text-4" id="text-1-2-1">
|
||||
<div id="outline-container-org05cd89a" class="outline-4">
|
||||
<h4 id="org05cd89a">Inserting region or register contents into snippet</h4>
|
||||
<div class="outline-text-4" id="text-org05cd89a">
|
||||
<p>
|
||||
It's often useful to inject already written text in the middle of a
|
||||
snippet. The variable <a href="snippet-reference.html#yas-wrap-around-region"><code>yas-wrap-around-region</code></a> when to t substitute
|
||||
the region contents into the <code>$0</code> placeholder of a snippet expanded by
|
||||
<i><code>yas-insert-snippet</code></i>. Setting it to a character value (e.g. <code>?0</code>)
|
||||
<a href="snippet-reference.html#yas-insert-snippet"><code>yas-insert-snippet</code></a>. Setting it to a character value (e.g. <code>?0</code>)
|
||||
will insert the contents of corresponding register.
|
||||
</p>
|
||||
|
||||
@@ -356,9 +438,9 @@ compatibility, but is now entirely equivalent to <code>?0</code>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1-3" class="outline-3">
|
||||
<h3 id="sec-1-3">Snippet keybinding</h3>
|
||||
<div class="outline-text-3" id="text-1-3">
|
||||
<div id="outline-container-orgc3c8799" class="outline-3">
|
||||
<h3 id="orgc3c8799">Snippet keybinding</h3>
|
||||
<div class="outline-text-3" id="text-orgc3c8799">
|
||||
<p>
|
||||
See the section of the <code># binding:</code> directive in
|
||||
<a href="./snippet-development.html">Writing Snippets</a>.
|
||||
@@ -366,18 +448,18 @@ See the section of the <code># binding:</code> directive in
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1-4" class="outline-3">
|
||||
<h3 id="sec-1-4">Expanding from the menu</h3>
|
||||
<div class="outline-text-3" id="text-1-4">
|
||||
<div id="outline-container-orgf5cd066" class="outline-3">
|
||||
<h3 id="orgf5cd066">Expanding from the menu</h3>
|
||||
<div class="outline-text-3" id="text-orgf5cd066">
|
||||
<p>
|
||||
See <a href="./snippet-menu.html">the YASnippet Menu</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1-5" class="outline-3">
|
||||
<h3 id="sec-1-5">Expanding with <code>hippie-expand</code></h3>
|
||||
<div class="outline-text-3" id="text-1-5">
|
||||
<div id="outline-container-orgaf084f4" class="outline-3">
|
||||
<h3 id="orgaf084f4">Expanding with <code>hippie-expand</code></h3>
|
||||
<div class="outline-text-3" id="text-orgaf084f4">
|
||||
<p>
|
||||
To integrate with <code>hippie-expand</code>, just put
|
||||
<a href="snippet-reference.html#yas-hippie-try-expand"><code>yas-hippie-try-expand</code></a> in
|
||||
@@ -388,9 +470,9 @@ prefer.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1-6" class="outline-3">
|
||||
<h3 id="sec-1-6">Expanding from emacs-lisp code</h3>
|
||||
<div class="outline-text-3" id="text-1-6">
|
||||
<div id="outline-container-orgb8b9e8f" class="outline-3">
|
||||
<h3 id="orgb8b9e8f">Expanding from emacs-lisp code</h3>
|
||||
<div class="outline-text-3" id="text-orgb8b9e8f">
|
||||
<p>
|
||||
Sometimes you might want to expand a snippet directly from your own
|
||||
elisp code. You should call <a href="snippet-reference.html#yas-expand-snippet"><code>yas-expand-snippet</code></a> instead of
|
||||
@@ -407,7 +489,6 @@ menu has the same effect of evaluating the follow code:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp">(yas-expand-snippet template)
|
||||
</pre>
|
||||
</div>
|
||||
@@ -420,12 +501,13 @@ See the internal documentation on <a href="snippet-reference.html#yas-expand-sni
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2" class="outline-2">
|
||||
<h2 id="sec-2">Controlling expansion</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
</div><div id="outline-container-sec-2-1" class="outline-3">
|
||||
<h3 id="sec-2-1">Eligible snippets</h3>
|
||||
<div class="outline-text-3" id="text-2-1">
|
||||
<div id="outline-container-org61654fd" class="outline-2">
|
||||
<h2 id="org61654fd">Controlling expansion</h2>
|
||||
<div class="outline-text-2" id="text-org61654fd">
|
||||
</div>
|
||||
<div id="outline-container-orga555023" class="outline-3">
|
||||
<h3 id="orga555023">Eligible snippets</h3>
|
||||
<div class="outline-text-3" id="text-orga555023">
|
||||
<p>
|
||||
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:
|
||||
</p>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>Currently loaded snippets tables
|
||||
<li><p>
|
||||
Currently loaded snippets tables
|
||||
</p>
|
||||
|
||||
<p>
|
||||
These are loaded from a directory hierarchy in your file system. See
|
||||
<a href="./snippet-organization.html">Organizing Snippets</a>. They are named
|
||||
after major modes like <code>html-mode</code>, <code>ruby-mode</code>, etc…
|
||||
</p>
|
||||
</li>
|
||||
</p></li>
|
||||
|
||||
<li>Major mode of the current buffer
|
||||
<li><p>
|
||||
Major mode of the current buffer
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If the currrent major mode matches one of the loaded snippet tables,
|
||||
then all that table's snippets are considered for expansion. Use
|
||||
<code>M-x describe-variable RET major-mode RET</code> to find out which major
|
||||
mode you are in currently.
|
||||
</p>
|
||||
</li>
|
||||
</p></li>
|
||||
|
||||
<li>Parent tables
|
||||
<li><p>
|
||||
Parent tables
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
</li>
|
||||
</p></li>
|
||||
|
||||
<li>Buffer-local list of extra modes
|
||||
<li><p>
|
||||
Buffer-local list of extra modes
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Use <i><code>yas-activate-extra-mode</code></i> to
|
||||
Use <a href="snippet-reference.html#yas-activate-extra-mode"><code>yas-activate-extra-mode</code></a> to
|
||||
consider snippet tables whose name does not correspond to a major
|
||||
mode. Typically, you call this from a minor mode hook, for example:
|
||||
</p>
|
||||
</li>
|
||||
</p></li>
|
||||
</ul>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp"><span class="org-comment-delimiter">;; </span><span class="org-comment">When entering rinari-minor-mode, consider also the snippets in the</span>
|
||||
<span class="org-comment-delimiter">;; </span><span class="org-comment">snippet table "rails-mode"</span>
|
||||
(add-hook 'rinari-minor-mode-hook
|
||||
@@ -485,23 +570,24 @@ mode. Typically, you call this from a minor mode hook, for example:
|
||||
</div>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>Buffer-local <a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a> variable
|
||||
<li><p>
|
||||
Buffer-local <a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a> variable
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This variable provides finer grained control over what snippets can
|
||||
be expanded in the current buffer. For example, the constant
|
||||
<a href="snippet-reference.html#yas-not-string-or-comment-condition"><code>yas-not-string-or-comment-condition</code></a> has a value that disables
|
||||
snippet expansion inside comments or string literals. See <a href="#condition-system">the
|
||||
snippet expansion inside comments or string literals. See <a href="#orgfd922ab">the
|
||||
condition system</a> for more info.
|
||||
</p>
|
||||
</li>
|
||||
</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-2" class="outline-3">
|
||||
<h3 id="sec-2-2">The condition system <a id="condition-system" name="condition-system"></a></h3>
|
||||
<div class="outline-text-3" id="text-2-2">
|
||||
<div id="outline-container-org075c5ff" class="outline-3">
|
||||
<h3 id="org075c5ff">The condition system <a id="orgfd922ab"></a></h3>
|
||||
<div class="outline-text-3" id="text-org075c5ff">
|
||||
<p>
|
||||
Consider this scenario: you are an old Emacs hacker. You like the
|
||||
abbrev-way and bind <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> to <code>SPC</code>. However, you don't want
|
||||
@@ -524,7 +610,6 @@ inside a comment? Set <a href="snippet-reference.html#yas-buffer-local-conditio
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp">(add-hook 'python-mode-hook
|
||||
(<span class="org-keyword">lambda</span> ()
|
||||
(<span class="org-keyword">setq</span> yas-buffer-local-condition
|
||||
@@ -548,11 +633,11 @@ For the full set of possible conditions, see the documentation for
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-3" class="outline-3">
|
||||
<h3 id="sec-2-3">Multiples snippet with the same key</h3>
|
||||
<div class="outline-text-3" id="text-2-3">
|
||||
<div id="outline-container-org2f6a9be" class="outline-3">
|
||||
<h3 id="org2f6a9be">Multiples snippet with the same key</h3>
|
||||
<div class="outline-text-3" id="text-org2f6a9be">
|
||||
<p>
|
||||
The rules outlined <i>above</i> can return more than
|
||||
The rules outlined <a href="#orga555023">above</a> can return more than
|
||||
one snippet to be expanded at point.
|
||||
</p>
|
||||
|
||||
@@ -570,7 +655,6 @@ can put in your emacs-file:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp">(<span class="org-keyword">setq</span> yas-prompt-functions '(yas-x-prompt yas-dropdown-prompt))
|
||||
</pre>
|
||||
</div>
|
||||
@@ -580,9 +664,9 @@ Currently there are some alternatives solution with YASnippet.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-3-1" class="outline-4">
|
||||
<h4 id="sec-2-3-1">Use the X window system</h4>
|
||||
<div class="outline-text-4" id="text-2-3-1">
|
||||
<div id="outline-container-org020d7e4" class="outline-4">
|
||||
<h4 id="org020d7e4">Use the X window system</h4>
|
||||
<div class="outline-text-4" id="text-org020d7e4">
|
||||
|
||||
<div class="figure">
|
||||
<p><img src="./images/x-menu.png" alt="x-menu.png" />
|
||||
@@ -597,20 +681,17 @@ means:
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>It usually looks beautiful. E.g. when you compile Emacs with gtk
|
||||
support, this menu will be rendered with your gtk theme.
|
||||
</li>
|
||||
support, this menu will be rendered with your gtk theme.</li>
|
||||
<li>Your window system may or may not allow to you use <code>C-n</code>, <code>C-p</code> to
|
||||
navigate this menu.
|
||||
</li>
|
||||
<li>This function can't be used when in a terminal.
|
||||
</li>
|
||||
navigate this menu.</li>
|
||||
<li>This function can't be used when in a terminal.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-3-2" class="outline-4">
|
||||
<h4 id="sec-2-3-2">Minibuffer prompting</h4>
|
||||
<div class="outline-text-4" id="text-2-3-2">
|
||||
<div id="outline-container-org8c16a13" class="outline-4">
|
||||
<h4 id="org8c16a13">Minibuffer prompting</h4>
|
||||
<div class="outline-text-4" id="text-org8c16a13">
|
||||
|
||||
<div class="figure">
|
||||
<p><img src="./images/ido-menu.png" alt="ido-menu.png" />
|
||||
@@ -625,9 +706,9 @@ The best way is to try it. This works in a terminal.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-3-3" class="outline-4">
|
||||
<h4 id="sec-2-3-3">Use <code>dropdown-menu.el</code></h4>
|
||||
<div class="outline-text-4" id="text-2-3-3">
|
||||
<div id="outline-container-orgb151bf6" class="outline-4">
|
||||
<h4 id="orgb151bf6">Use <code>dropdown-menu.el</code></h4>
|
||||
<div class="outline-text-4" id="text-orgb151bf6">
|
||||
|
||||
<div class="figure">
|
||||
<p><img src="./images/dropdown-menu.png" alt="dropdown-menu.png" />
|
||||
@@ -647,9 +728,9 @@ shortcut to select the 6th candidate.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-3-4" class="outline-4">
|
||||
<h4 id="sec-2-3-4">Roll your own</h4>
|
||||
<div class="outline-text-4" id="text-2-3-4">
|
||||
<div id="outline-container-orgda9ea36" class="outline-4">
|
||||
<h4 id="orgda9ea36">Roll your own</h4>
|
||||
<div class="outline-text-4" id="text-orgda9ea36">
|
||||
<p>
|
||||
See the documentation on variable <a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a>
|
||||
</p>
|
||||
@@ -659,7 +740,7 @@ See the documentation on variable <a href="snippet-reference.html#yas-prompt-fun
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<hr><p class='creator'>Generated by <a href="http://www.gnu.org/software/emacs/">Emacs</a> 25.2.50.5 (<a href="http://orgmode.org">Org</a> mode 8.2.10) from 0.12.2 (2017-08-29 02:08:58)</p>
|
||||
<hr><p class='creator'>Generated by <a href="https://www.gnu.org/software/emacs/">Emacs</a> 26.1 (<a href="https://orgmode.org">Org</a> mode 9.1.9) from 0.13.0 (2018-05-13 16:12:51)</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user