emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: Using yasnippet with org Mode (C-i works TAB doesn't)


From: Carsten Dominik
Subject: Re: [Orgmode] Re: Using yasnippet with org Mode (C-i works TAB doesn't)
Date: Mon, 21 Sep 2009 18:18:56 +0100

Hi Eric,

could I ask you to update the FAQ with this issue?

Thanks.

- Carsten

On Sep 20, 2009, at 3:16 PM, Eric Schulte wrote:

Nicolas Goaziou <address@hidden> writes:

Jeff Kowalczyk <address@hidden> 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.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode





reply via email to

[Prev in Thread] Current Thread [Next in Thread]