From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Horn Subject: Making yasnippet work in indirect Org Src latex buffers Date: Tue, 1 Mar 2011 18:49:18 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from [140.186.70.92] (port=37348 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PuZK2-0008Vz-Mx for emacs-orgmode@gnu.org; Tue, 01 Mar 2011 18:49:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PuZK1-0002tZ-Em for emacs-orgmode@gnu.org; Tue, 01 Mar 2011 18:49:42 -0500 Received: from mail-fx0-f41.google.com ([209.85.161.41]:51286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PuZK1-0002tO-3e for emacs-orgmode@gnu.org; Tue, 01 Mar 2011 18:49:41 -0500 Received: by fxm5 with SMTP id 5so6368846fxm.0 for ; Tue, 01 Mar 2011 15:49:39 -0800 (PST) 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: Org-mode ml yasnippet wasn't working for me in indirect buffers, nor was it working in regular LaTeX mode buffers. I figured it might be because of cdlatex, so I googled around. I like both minor modes, what can I say? :-) I thought I'd share the solution I found for archival purposes! http://notes.seanwhitton.com/2010/12/making-yasnippet-and-cdlatex-mode-play-nice-together.html The relevant portion of the code is below. Just drop this in your starter file. It works for me, and I'm using Eric Schulte's starter-kit, so you might need to have a look at the whole solution linked above. #+begin_src emacs-lisp (defun yas/advise-indent-function (function-symbol) (eval `(defadvice ,function-symbol (around yas/try-expand-first activate) ,(format "Try to expand a snippet before point, then call `%s' as usual" function-symbol) (let ((yas/fallback-behavior nil)) (unless (and (interactive-p) (yas/expand)) ad-do-it))))) (yas/advise-indent-function 'cdlatex-tab) #+end_src -- Jeffrey Horn http://www.failuretorefrain.com/jeff/