org-mode and yasnippet incompatibility

Discussion of programming Lisps using Emacs, including SLIME and other tools
Post Reply
Posts: 3
Joined: Sat May 11, 2013 9:36 am

org-mode and yasnippet incompatibility

Post by dagst47 » Thu May 23, 2013 9:55 pm

Using Aquamacs 2.4 (built on Emacs with yasnippet 0.6.1.
Whenever i'm in org-mode, after calling "M-x yas/minor-mode", <tab> does not expand the snippet from the shortcut snippet name, but I can still insert a snippet by using the menu. I even tried calling "yas/snippet-expand" and that also did not work. Still, using the mouse and menu works as expected.
I followed both solutions posted in the manual with no success:
I cannot seem to override the re-keymapping that org-mode puts into place.
Has anyone else had this problem, and how can I fix the issue?

Thank you for any help.

My .emacs is very sparse as follows:

(require 'yasnippet "~/.emacs.d/packages/yasnippet-0.6.1c/yasnippet.el")
(setq yas/root-directory "~/.emacs.d/packages/yasnippet-0.6.1c/snippets")
(yas/load-directory yas/root-directory)

(require `org-install)
(add-to-list `auto-mode-alist `("\\.org$" . org-mode))
(define-key global-map "\C-cl" `org-store-link)
(define-key global-map "\C-ca" `org-agenda)

; settings to try to force yasnippet to work with org-mode
(defun yas/org-very-safe-expand ()
(let ((yas/fallback-behavior 'return-nil)) (yas/expand)))

(add-hook 'org-mode-hook
(lambda ()
(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)))

Post Reply