From: "Eric Schulte" <schulte.eric@gmail.com>
To: Jeff Kowalczyk <jtk@yahoo.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: Using yasnippet with org Mode (C-i works TAB doesn't)
Date: Sun, 20 Sep 2009 08:16:02 -0600 [thread overview]
Message-ID: <m2skeh1z31.fsf@gmail.com> (raw)
In-Reply-To: <87iqff6q81.fsf@gmail.com> (Nicolas Goaziou's message of "Sat, 19 Sep 2009 15:03:58 +0200")
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Jeff Kowalczyk <jtk@yahoo.com> 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,
next prev parent reply other threads:[~2009-09-20 14:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-23 19:23 Using yasnippet with org Mode Ian Barton
2008-11-23 21:11 ` Eric Schulte
2008-11-23 21:17 ` Tassilo Horn
2008-11-23 22:43 ` Eric Schulte
2008-11-24 9:34 ` Ian Barton
2008-11-24 23:51 ` Sebastian Rose
2008-11-24 14:46 ` Re: Using yasnippet with org Mode [Solved] Ian Barton
2008-11-24 15:38 ` Re: Using yasnippet with org Mode Eric Schulte
2008-11-24 0:45 ` Oliver Charles
2008-11-24 15:40 ` Eric Schulte
2008-11-25 15:44 ` Org mode snippets WAS: " Jonathan Arkell
2009-09-19 5:06 ` Using yasnippet with org Mode (C-i works TAB doesn't) Jeff Kowalczyk
2009-09-19 13:03 ` Nicolas Goaziou
2009-09-20 14:16 ` Eric Schulte [this message]
2009-09-21 17:18 ` Carsten Dominik
2009-09-22 15:52 ` Nicolas Goaziou
2009-09-22 19:22 ` Eric Schulte
2009-09-19 13:46 ` Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2skeh1z31.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=jtk@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.