title: Conflicts between org-mode and yasnippet
body: <p><strong>EDIT</strong> My issue was related to snippet syntax all along... The configuration below totally works.</p>
  
  <hr>
  
  <p>I'm trying to use org-mode and yasnippet together and it's not working even with some of the <a href="http://orgmode.org/worg/org-faq.html#YASnippet" rel="nofollow">workarounds</a> on the org-mode FAQ. Whenever I hit <kbd>TAB</kbd> on a snippet abbreviation the word gets deleted. <kbd>TAB</kbd> behaves normally if I'm not over a snippet word, so there's something going on...</p>
  
  <p>I'm using <code>Org-mode version 7.7</code>, <code>yasnippet (version 0.7.0)</code>, and <code>GNU Emacs 23.4.1</code>.</p>
  
  <p>Here's my setup:</p>
  
  <pre class="lang-lisp prettyprint-override"><code>(setq load-path
        (append (list nil
                      "~/.emacs.d/site-lisp/yasnippet"
                      "~/.emacs.d/site-lisp/org-7.7/lisp")
                load-path))
  
  ;; set up yasnippet
  (require 'yasnippet)
  (yas/initialize)
  (setq yas/snippet-dirs '("~/.emacs.d/mysnippets"
                           "~/.emacs.d/site-lisp/yasnippet/snippets"))
  (mapc 'yas/load-directory yas/snippet-dirs)
  
  ;; set up org mode
  (require 'org-install)
  ;; fix some org-mode + yasnippet conflicts:
  (defun yas/org-very-safe-expand ()
    (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
  
  (add-hook 'org-mode-hook
            (lambda ()
              (make-variable-buffer-local 'yas/trigger-key)
              (setq yas/trigger-key [tab])
              (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
              (define-key yas/keymap [tab] 'yas/next-field)))
  </code></pre>
  
  <p>And I'm pretty sure the hook is running as expected because of the following output of <kbd>C-h v org-tab-first-hook</kbd> in an org buffer:</p>
  
  <pre><code>org-tab-first-hook is a variable defined in `org.el'.
  Its value is
  (yas/org-very-safe-expand org-hide-block-toggle-maybe org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe)
  </code></pre>
  
  <p>And here's <kbd>C-h k TAB</kbd> in an org buffer:</p>
  
  <pre><code>&lt;tab&gt; runs the command org-cycle, which is an interactive Lisp
  function in `org.el'.
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>After doing a <code>edebug-defun</code> on my <code>yas/org-very-safe-expand</code> function I'm seeing the following message</p>
  
  <pre><code>Result: "[yas] elisp error! Symbol's value as variable is void: err"
  </code></pre>
  
  <p>So yas is error'ing out somewhere... My <code>edebug</code> foo is not quite up to par but if I get some time I'll try to single step through and see where the error is. My full emacs configuration is on github <a href="https://github.com/mgalgs/.emacs.d" rel="nofollow">here</a>.</p>