mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
updated the faq with results from the tab key issue
This commit is contained in:
parent
037f8fd3ee
commit
69df357ae8
19
doc/faq.html
19
doc/faq.html
@ -87,14 +87,15 @@ latter has priority. If you see <tt class="docutils literal"><span class="pre">&
|
|||||||
than <tt class="docutils literal"><span class="pre">yas/expand</span></tt>, (e.g. in <tt class="docutils literal"><span class="pre">org-mode</span></tt>) you can try the following
|
than <tt class="docutils literal"><span class="pre">yas/expand</span></tt>, (e.g. in <tt class="docutils literal"><span class="pre">org-mode</span></tt>) you can try the following
|
||||||
code to work around:</p>
|
code to work around:</p>
|
||||||
<div class="highlight"><pre>(add-hook 'org-mode-hook
|
<div class="highlight"><pre>(add-hook 'org-mode-hook
|
||||||
#'(lambda ()
|
(let ((original-command (lookup-key org-mode-map [tab])))
|
||||||
(setq yas/fallback-behavior
|
`(lambda ()
|
||||||
`(apply ,(lookup-key org-mode-map [tab])))
|
(setq yas/fallback-behavior
|
||||||
(local-set-key [tab] 'yas/expand)))
|
'(apply ,original-command))
|
||||||
|
(local-set-key [tab] 'yas/expand))))
|
||||||
</pre></div>
|
</pre></div>
|
||||||
<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
|
<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
|
hook you are dealing with (Use <tt class="docutils literal"><span class="pre">C-h</span> <span class="pre">m</span></tt> to see what major mode you
|
||||||
in).</p>
|
are in).</p>
|
||||||
<p>As an alternative, you can also try</p>
|
<p>As an alternative, you can also try</p>
|
||||||
<div class="highlight"><pre>(defun yas/advise-indent-function (function-symbol)
|
<div class="highlight"><pre>(defun yas/advise-indent-function (function-symbol)
|
||||||
(eval `(defadvice ,function-symbol (around yas/try-expand-first activate)
|
(eval `(defadvice ,function-symbol (around yas/try-expand-first activate)
|
||||||
@ -110,10 +111,12 @@ in).</p>
|
|||||||
</pre></div>
|
</pre></div>
|
||||||
<p>To <em>advise</em> the modes indentation function bound to TAB, (in this case
|
<p>To <em>advise</em> the modes indentation function bound to TAB, (in this case
|
||||||
<tt class="docutils literal"><span class="pre">ruby-indent-line</span></tt>) to first try to run <tt class="docutils literal"><span class="pre">yas/expand</span></tt>.</p>
|
<tt class="docutils literal"><span class="pre">ruby-indent-line</span></tt>) to first try to run <tt class="docutils literal"><span class="pre">yas/expand</span></tt>.</p>
|
||||||
<p>If The output of <tt class="docutils literal"><span class="pre">C-h</span> <span class="pre">k</span> <span class="pre">RET</span> <span class="pre"><tab></span></tt> tells you that <tt class="docutils literal"><span class="pre"><tab></span></tt> is
|
<p>If the output of <tt class="docutils literal"><span class="pre">C-h</span> <span class="pre">k</span> <span class="pre">RET</span> <span class="pre"><tab></span></tt> tells you that <tt class="docutils literal"><span class="pre"><tab></span></tt> is
|
||||||
indeed bound to <tt class="docutils literal"><span class="pre">yas/expand</span></tt> but YASnippet still doesn't work, check
|
indeed bound to <tt class="docutils literal"><span class="pre">yas/expand</span></tt> but YASnippet still doesn't work, check
|
||||||
your configuration and you may also ask for help on the <a class="reference external" href="http://groups.google.com/group/smart-snippet">discussion
|
your configuration and you may also ask for help on the <a class="reference external" href="http://groups.google.com/group/smart-snippet">discussion
|
||||||
group</a>.</p>
|
group</a>. See this
|
||||||
|
particular <a class="reference external" href="http://code.google.com/p/yasnippet/issues/detail?id=93&can=1">thread</a> for
|
||||||
|
quite some solutions and alternatives.</p>
|
||||||
<p>Don't forget to attach the information on what command is bound to TAB
|
<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>
|
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>
|
||||||
|
20
doc/faq.rst
20
doc/faq.rst
@ -47,14 +47,15 @@ code to work around:
|
|||||||
.. sourcecode:: lisp
|
.. sourcecode:: lisp
|
||||||
|
|
||||||
(add-hook 'org-mode-hook
|
(add-hook 'org-mode-hook
|
||||||
#'(lambda ()
|
(let ((original-command (lookup-key org-mode-map [tab])))
|
||||||
(setq yas/fallback-behavior
|
`(lambda ()
|
||||||
`(apply ,(lookup-key org-mode-map [tab])))
|
(setq yas/fallback-behavior
|
||||||
(local-set-key [tab] 'yas/expand)))
|
'(apply ,original-command))
|
||||||
|
(local-set-key [tab] 'yas/expand))))
|
||||||
|
|
||||||
replace ``org-mode-hook`` and ``org-mode-map`` with the major mode
|
replace ``org-mode-hook`` and ``org-mode-map`` with the major mode
|
||||||
hook you are dealing with (``C-h m`` to see what major mode you are
|
hook you are dealing with (Use ``C-h m`` to see what major mode you
|
||||||
in).
|
are in).
|
||||||
|
|
||||||
As an alternative, you can also try
|
As an alternative, you can also try
|
||||||
|
|
||||||
@ -75,10 +76,13 @@ As an alternative, you can also try
|
|||||||
To *advise* the modes indentation function bound to TAB, (in this case
|
To *advise* the modes indentation function bound to TAB, (in this case
|
||||||
``ruby-indent-line``) to first try to run ``yas/expand``.
|
``ruby-indent-line``) to first try to run ``yas/expand``.
|
||||||
|
|
||||||
If The output of ``C-h k RET <tab>`` tells you that ``<tab>`` is
|
If the output of ``C-h k RET <tab>`` tells you that ``<tab>`` is
|
||||||
indeed bound to ``yas/expand`` but YASnippet still doesn't work, check
|
indeed bound to ``yas/expand`` but YASnippet still doesn't work, check
|
||||||
your configuration and you may also ask for help on the `discussion
|
your configuration and you may also ask for help on the `discussion
|
||||||
group <http://groups.google.com/group/smart-snippet>`_.
|
group <http://groups.google.com/group/smart-snippet>`_. See this
|
||||||
|
particular `thread
|
||||||
|
<http://code.google.com/p/yasnippet/issues/detail?id=93&can=1>`_ for
|
||||||
|
quite some solutions and alternatives.
|
||||||
|
|
||||||
Don't forget to attach the information on what command is bound to TAB
|
Don't forget to attach the information on what command is bound to TAB
|
||||||
as well as the mode information (Can be obtained by ``C-h m``).
|
as well as the mode information (Can be obtained by ``C-h m``).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user