mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-02-04 14:32:26 +00:00
* Fixed issue 98, issue 93 and issues related to the customization group
* Added workaround for issue 97 in the FAQ * Minor updates in the documentation
This commit is contained in:
52
doc/faq.html
52
doc/faq.html
@@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
|
||||
<title>Frequently Asked Questions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css" />
|
||||
</head>
|
||||
@@ -54,8 +54,8 @@
|
||||
for other versions can be found <a title=""
|
||||
href="http://code.google.com/p/yasnippet/downloads/list">here</a>.
|
||||
</p>
|
||||
<div class="section" id="why-there-s-an-extra-newline">
|
||||
<h1>Why there's an extra newline?</h1>
|
||||
<div class="section" id="why-is-there-an-extra-newline">
|
||||
<h1>Why is there an extra newline?</h1>
|
||||
<p>If you have a newline at the end of the snippet definition file, then
|
||||
YASnippet will add a newline when you expanding a snippet. Please
|
||||
don't add a newline at the end if you don't want it when you saving
|
||||
@@ -64,8 +64,8 @@ the snippet file.</p>
|
||||
if you set <tt class="docutils literal"><span class="pre">require-final-newline</span></tt> to <tt class="docutils literal"><span class="pre">t</span></tt>, it will add the final
|
||||
newline for you automatically.</p>
|
||||
</div>
|
||||
<div class="section" id="why-tab-key-doesn-t-expand-a-snippet">
|
||||
<h1>Why TAB key doesn't expand a snippet?</h1>
|
||||
<div class="section" id="why-doesn-t-tab-expand-a-snippet">
|
||||
<h1>Why doesn't TAB expand a snippet?</h1>
|
||||
<p>First check the mode line to see if there's <tt class="docutils literal"><span class="pre">yas</span></tt>. If not, then try
|
||||
<tt class="docutils literal"><span class="pre">M-x</span> <span class="pre">yas/minor-mode</span></tt> to manually turn on the minor mode and try to
|
||||
expand the snippet again. If it works, then, you can add the following
|
||||
@@ -88,11 +88,14 @@ than <tt class="docutils literal"><span class="pre">yas/expand</span></tt>, (e.g
|
||||
code to work around:</p>
|
||||
<div class="highlight"><pre>(add-hook 'org-mode-hook
|
||||
#'(lambda ()
|
||||
(setq yas/fallback-behavior
|
||||
`(apply ,(lookup-key org-mode-map [tab])))
|
||||
(local-set-key [tab] 'yas/expand)))
|
||||
</pre></div>
|
||||
<p>replace <tt class="docutils literal"><span class="pre">org-mode-hook</span></tt> with the major mode hook you are dealing
|
||||
with (<tt class="docutils literal"><span class="pre">C-h</span> <span class="pre">m</span></tt> to see what major mode you are in).</p>
|
||||
<p>If this doesn't work, you can also try</p>
|
||||
<p>replace <tt class="docutils literal"><span class="pre">org-mode-hook</span></tt> and <tt class="docutils literal"><span class="pre">org-mode-map</span></tt> with the major mode
|
||||
hook you are dealing with (<tt class="docutils literal"><span class="pre">C-h</span> <span class="pre">m</span></tt> to see what major mode you are
|
||||
in).</p>
|
||||
<p>As an alternative, you can also try</p>
|
||||
<div class="highlight"><pre>(defun yas/advise-indent-function (function-symbol)
|
||||
(eval `(defadvice ,function-symbol (around yas/try-expand-first activate)
|
||||
,(format
|
||||
@@ -114,15 +117,30 @@ group</a>.</p>
|
||||
<p>Don't forget to attach the information on what command is bound to TAB
|
||||
as well as the mode information (Can be obtained by <tt class="docutils literal"><span class="pre">C-h</span> <span class="pre">m</span></tt>).</p>
|
||||
</div>
|
||||
<div class="section" id="how-to-define-snippets-with-named-by-characters-not-supported-by-the-filesystem">
|
||||
<h1>How to define snippets with named by characters not supported by the filesystem?</h1>
|
||||
<p>For example, you want to define a snippet by the key <tt class="docutils literal"><span class="pre"><</span></tt> which is not a
|
||||
valid character for filename on Windows. In this case, you may use
|
||||
<tt class="docutils literal"><span class="pre">yas/define</span></tt> to define the snippet. If you want to enjoy defining
|
||||
snippets in a file, you can use the <tt class="docutils literal"><span class="pre">key</span></tt> property to specify the key of
|
||||
the defined snippet explicitly.</p>
|
||||
<p>Just name your snippet with an arbitrary valid filename, <tt class="docutils literal"><span class="pre">lt</span></tt> for
|
||||
example. and specify <tt class="docutils literal"><span class="pre"><</span></tt> for the <tt class="docutils literal"><span class="pre">key</span></tt> property:</p>
|
||||
<div class="section" id="why-doesn-t-tab-navigation-work-with-flyspell">
|
||||
<h1>Why doesn't TAB navigation work with flyspell</h1>
|
||||
<p>A workaround is to inhibit flyspell overlays while the snippet is active:</p>
|
||||
<div class="highlight"><pre>(add-hook 'flyspell-incorrect-hook
|
||||
#'(lambda (dummy1 dummy2 dymmy3)
|
||||
(and yas/active-field-overlay
|
||||
(overlay-buffer yas/active-field-overlay))))
|
||||
</pre></div>
|
||||
<p>This is apparently related to overlay priorities. For some reason, the
|
||||
<tt class="docutils literal"><span class="pre">keymap</span></tt> property of flyspell's overlays always takes priority over
|
||||
the same property in yasnippet's overlays, even if one sets the
|
||||
latter's <tt class="docutils literal"><span class="pre">priority</span></tt> property to something big. If you know
|
||||
emacs-lisp and can solve this problem, drop a line in the <a class="reference external" href="http://groups.google.com/group/smart-snippet">discussion
|
||||
group</a>.</p>
|
||||
</div>
|
||||
<div class="section" id="how-do-i-define-an-abbrev-key-containing-characters-not-supported-by-the-filesystem">
|
||||
<h1>How do I define an abbrev key containing characters not supported by the filesystem?</h1>
|
||||
<p>For example, you want to define a snippet by the key <tt class="docutils literal"><span class="pre"><</span></tt> which is
|
||||
not a valid character for filename on Windows. This means you can't
|
||||
use the filename as a trigger key in this case.</p>
|
||||
<p>You should rather use the <tt class="docutils literal"><span class="pre">#</span> <span class="pre">key:</span></tt> directive to specify the key of
|
||||
the defined snippet explicitly and name your snippet with an arbitrary
|
||||
valid filename, <tt class="docutils literal"><span class="pre">lt.yasnippet</span></tt> for example, using <tt class="docutils literal"><span class="pre"><</span></tt> for the
|
||||
<tt class="docutils literal"><span class="pre">#</span> <span class="pre">key:</span></tt> directive:</p>
|
||||
<div class="highlight"><pre>#key: <
|
||||
#name: <...></...>
|
||||
# --
|
||||
|
||||
Reference in New Issue
Block a user