From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: Using yasnippet with org Mode (C-i works TAB doesn't) Date: Mon, 21 Sep 2009 18:18:56 +0100 Message-ID: <34D737CF-4757-4F73-9B1D-F22E860A2480@gmail.com> References: <4929ADBB.6050809@manor-farm.org> <87iqff6q81.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MpmXY-0004zh-6L for emacs-orgmode@gnu.org; Mon, 21 Sep 2009 13:19:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MpmXW-0004yX-Bj for emacs-orgmode@gnu.org; Mon, 21 Sep 2009 13:19:02 -0400 Received: from [199.232.76.173] (port=32902 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MpmXW-0004yU-9G for emacs-orgmode@gnu.org; Mon, 21 Sep 2009 13:19:02 -0400 Received: from ey-out-1920.google.com ([74.125.78.148]:1561) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MpmXV-0003hw-Pm for emacs-orgmode@gnu.org; Mon, 21 Sep 2009 13:19:02 -0400 Received: by ey-out-1920.google.com with SMTP id 3so1249737eyh.34 for ; Mon, 21 Sep 2009 10:19:00 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Jeff Kowalczyk , emacs-orgmode@gnu.org 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 writes: > >> Jeff Kowalczyk 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. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode