Org-Mode and Yasnippet with <backtab>

In Emacs, how can I change the org-mode group diagram so that shift-tab starts yas-expand instead of org-shifttab? Even better, how can I make shift-tab only run yas-expand when the point is in front of the fragment trigger, and otherwise runs org-shifttab?

In addition, I saw this entry in the org-mode wiki. The first option did not work, and I could not get the second option, because I could not find the equivalentbacktab org-tab-first-hook

The Org method binds a key (binding to [tab] instead of "\ t") blocks YASnippet's access to this key. The following code has fixed this problem:

(add-hook 'org-mode-hook
          (lambda ()
            (org-set-local 'yas/trigger-key [tab])
            (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))

The latest version of yasnippet does not work very well with Org mode. If the above code does not resolve the conflict, starting with the definition of the following function:

      (defun yas/org-very-safe-expand ()
        (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))

Org, :

      (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)))
+4

All Articles