Nicolas Goaziou <[email protected]> writes:
> Jeff Kowalczyk <[email protected]> writes:
>
>> (add-hook 'org-mode-hook
>> (lambda ()
>> (org-set-local 'yas/trigger-key [tab])
>> (define-key yas/keymap [tab] 'yas/next-field-group)))
>
> According to the yasnippet FAQ (or is it on its forum), it should be
>
> (add-hook 'org-mode-hook
> #'(lambda ()
> (setq yas/fallback-behavior
> `(apply ,(lookup-key org-mode-map [tab])))
> (local-set-key [tab] 'yas/expand)))
>
> Anyway, there is one major problem left, it doesn't work with
> org-indent-mode as, when you press TAB to get to the next field of a
> snippet, you are sent to the first headline in the org file.
>
> I have yet to find a workaround about that.
>
After upgrading to the newest version of yasnippet I was dismayed to
find it no longer working in my own org-mode files. After some painful
trial and error I found that the following setup works for me.
--8<---------------cut here---------------start------------->8---
(defun yas/org-very-safe-expand ()
(let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
(add-hook 'org-mode-hook
(lambda ()
;; yasnippet (using the new org-cycle hooks)
(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)))
--8<---------------cut here---------------end--------------->8---
-- Eric
>
> Regards,
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-orgmode