emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Making yasnippet work in indirect Org Src latex buffers


From: Jeff Horn
Subject: [O] Making yasnippet work in indirect Org Src latex buffers
Date: Tue, 1 Mar 2011 18:49:18 -0500

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/



reply via email to

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