From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Elston Subject: Re: Use with yasnippets? Date: Thu, 23 Apr 2009 18:48:56 -0700 Message-ID: <49F11A88.5050700@comcast.net> References: <49F0F58D.7070109@comcast.net> <87prf2q118.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LxAXs-0002H8-JM for emacs-orgmode@gnu.org; Thu, 23 Apr 2009 21:49:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LxAXo-0002GY-Uc for emacs-orgmode@gnu.org; Thu, 23 Apr 2009 21:49:40 -0400 Received: from [199.232.76.173] (port=49884 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LxAXo-0002GV-Pi for emacs-orgmode@gnu.org; Thu, 23 Apr 2009 21:49:36 -0400 Received: from qmta10.westchester.pa.mail.comcast.net ([76.96.62.17]:58601) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LxAXn-0007el-AX for emacs-orgmode@gnu.org; Thu, 23 Apr 2009 21:49:36 -0400 In-Reply-To: <87prf2q118.fsf@gollum.intra.norang.ca> 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: Bernt Hansen Cc: org-mode emacs-orgmode Bernt, Thanks. That was it. I knew there must be a mode-hook or some such I could take advantage of ant that was what I was missing. Mark Bernt Hansen wrote: > Mark Elston writes: > >> I know someone mentioned yasnippets earlier this month but I can't >> find it. And I don't know if it answers my question or not anyway. >> >> I have a number of *very* similar entries in an org file. I teach >> a number of classes and I would like to set up a yasnippet to create >> entries (actually a small tree of entries) for each class. The >> snippet would have several tab-stops so I can enter the class name >> and lesson number once and have it appear several times in the >> created entries. >> >> However, when trying to actually expand this snippet and navigate >> between the tab-stops, the tab key (naturally) closes up the tree >> it just created and fails to let me enter the second (or subsequent) >> placeholders. >> >> Is there any way of using the flexibility of yasnippets in org mode? > > Hi Mark, > > It mostly works for me. > > I just made the following test snippet: > > ,----[ test ] > | #name : #+test > | # -- > | * $1 > | First thing > | ** $2 > | Second thing > | *** $3 > | Third Thing > | *** $4 > | Fourth thing > | ** $5 > | Fifth thing > | Done. > | $0 > `---- > > and typing 'testTAB' and repeatedly hitting TAB and entering data gave > me this output > > ,---- > | * one > | First thing > | ** two > | Second thing > | *** three > | Third Thing > | *** four > | Fourth thing > | ** five > | Fifth thing > | Done. > | six > `---- > > I have the following setup for yasnippets - it's not perfect (because it > messes up forward TAB in tables) but it is working pretty well -- good > enough that I don't want to go back to not using yasnippets :) > > > --8<---------------cut here---------------start------------->8--- > (add-hook 'org-mode-hook > (lambda () > ;; yasnippet > (make-variable-buffer-local 'yas/trigger-key) > (setq yas/trigger-key [tab]) > (define-key yas/keymap [tab] 'yas/next-field-group) > (flyspell-mode 1))) > > (require 'yasnippet) > (yas/initialize) > (yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets") > --8<---------------cut here---------------end--------------->8--- > > HTH, > Bernt > >