emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Making yasnippet work in indirect Org Src latex buffers
@ 2011-03-01 23:49 Jeff Horn
  0 siblings, 0 replies; only message in thread
From: Jeff Horn @ 2011-03-01 23:49 UTC (permalink / raw)
  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/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-01 23:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-01 23:49 Making yasnippet work in indirect Org Src latex buffers Jeff Horn

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).