From 69df357ae836105f1dbaa0afe8df6cdee0d74030 Mon Sep 17 00:00:00 2001 From: capitaomorte Date: Fri, 25 Sep 2009 09:05:50 +0000 Subject: [PATCH] updated the faq with results from the tab key issue --- doc/faq.html | 19 +++++++++++-------- doc/faq.rst | 20 ++++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/doc/faq.html b/doc/faq.html index 705f49c..b3ef304 100644 --- a/doc/faq.html +++ b/doc/faq.html @@ -87,14 +87,15 @@ latter has priority. If you see & than yas/expand, (e.g. in org-mode) you can try the following code to work around:

(add-hook 'org-mode-hook
-          #'(lambda ()
-              (setq yas/fallback-behavior
-                    `(apply ,(lookup-key org-mode-map [tab])))
-              (local-set-key [tab] 'yas/expand)))
+          (let ((original-command (lookup-key org-mode-map [tab])))
+            `(lambda ()
+               (setq yas/fallback-behavior
+                     '(apply ,original-command))
+               (local-set-key [tab] 'yas/expand))))
 

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 -in).

+hook you are dealing with (Use C-h m to see what major mode you +are in).

As an alternative, you can also try

(defun yas/advise-indent-function (function-symbol)
   (eval `(defadvice ,function-symbol (around yas/try-expand-first activate)
@@ -110,10 +111,12 @@ in).

To advise the modes indentation function bound to TAB, (in this case 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 your configuration and you may also ask for help on the discussion -group.

+group. See this +particular thread for +quite some solutions and alternatives.

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).

diff --git a/doc/faq.rst b/doc/faq.rst index ab799ea..ad1fa72 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -47,14 +47,15 @@ code to work around: .. sourcecode:: lisp (add-hook 'org-mode-hook - #'(lambda () - (setq yas/fallback-behavior - `(apply ,(lookup-key org-mode-map [tab]))) - (local-set-key [tab] 'yas/expand))) + (let ((original-command (lookup-key org-mode-map [tab]))) + `(lambda () + (setq yas/fallback-behavior + '(apply ,original-command)) + (local-set-key [tab] 'yas/expand)))) 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 -in). +hook you are dealing with (Use ``C-h m`` to see what major mode you +are in). 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 ``ruby-indent-line``) to first try to run ``yas/expand``. -If The output of ``C-h k RET `` tells you that ```` is +If the output of ``C-h k RET `` tells you that ```` is indeed bound to ``yas/expand`` but YASnippet still doesn't work, check your configuration and you may also ask for help on the `discussion -group `_. +group `_. See this +particular `thread +`_ for +quite some solutions and alternatives. 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``).