Ian,
this is my yasnippets setup: .emacs => --->8----------------------------->8----------------------------->8--- (require 'yasnippet) ;; not yasnippet-bundle (yas/initialize) (yas/load-directory "/home/sebastian/emacs/snippets/") ;; I use the WIN key for my own bindings, since I didn't use Windows for ;; ages, and I don't plan to :-) ;; H-y is convenient on german keyboard (like M-z on english/US ;; keyboard): (defun sr-yas-in-org () "Define H-y as yas/expand in org" (define-key org-mode-map [(hyper ?y)] 'yas/expand)) (add-hook 'org-mode-hook 'sr-yas-in-org) <= ---8<-----------------------------8<-----------------------------8<--- Setup of the snippets tree beneath /home/sebastian/emacs/snippets/: . `-- fundamental-mode |-- cc-mode | |-- c++-mode | `-- c-mode |-- css-mode |-- html-mode |-- java-mode |-- message-mode |-- org-mode |-- perl-mode | `-- cperl-mode |-- php-mode `-- picture-mode As you can see, all modes inherit the snippets from fundamental mode. Example: There's a `box' snippet in fundamental-mode which I may use in all modes. It lives in a file named `box' in fundamental-mode and produces an output like this: ,---------------. ! this is a box | `---------------´ Since I have _no_ file named `box' in `org-mode', expanding "box" in an Org-file looks just the same: ,----------------------. ! This is a box in org | `----------------------´ For some modes, I overwrite it, simply by adding a file name `box' in the appropriate subdirectory. This is the result of expanding `php-mode/box' in a Php-file: // ------------- // // This is a box // // ------------- // ... and in `picture-mode/box': : +-----------------------+ : | A box in picture-mode | : +-----------------------+ The former is what used, if I expand the `org-mode/ditaa' snippet in an org-file, and press C-c ' #+begin_ditaa asdf.png -o : +-----------------------+ : | A box in picture-mode | : +-----------------------+ #+end_ditaa In picture-mode, I have several boxes. I may choose one using the arrow keys, if all their filenames start with 'box': picture-mode/box: +------------------------+ | A box in pictqure-mode | +------------------------+ picture-mode/box.stippled-rounded: /---------\ | Rounded | \---------/ picture-mode/box.stippled: +--------=-+ | Stippled | +----------+ picture-mode/box.stippled-rounded: /--------------------=-\ | Rounded and stippled | \----------------------/ box: => --->8----------------------------->8----------------------------->8--- #name : ! box | # -- ,${1:$(make-string (string-width text) ?\-)}--. ! ${1:SubTitle} | \`${1:$(make-string (string-width text) ?\-)}--´ $0 <= ---8<-----------------------------8<-----------------------------8<--- picture-mode/box (you have to draw the closing `|' yourself): => --->8----------------------------->8----------------------------->8--- #name : | straight | # -- +${1:$(make-string (string-width text) ?\-)}--+ | ${1:Entity} |$0 +${1:$(make-string (string-width text) ?\-)}--+ <= ---8<-----------------------------8<-----------------------------8<--- picture-mode/box.rounded: => --->8----------------------------->8----------------------------->8--- #name : | rounded | # -- /${1:$(make-string (string-width text) ?\-)}--\\ | ${1:Entity} |$0 \\${1:$(make-string (string-width text) ?\-)}--/ <= ---8<-----------------------------8<-----------------------------8<--- One of my most used ones is this here in `php-mode/debug': => --->8----------------------------->8----------------------------->8--- #contributor : Sebastian Rose <[EMAIL PROTECTED]> #name : echo "<pre>"; print_r( ... # -- echo "<pre><b>\\\$$1:</b><br />"; print_r(\$$1); echo "<br />".__FILE__.", line ".__LINE__."</pre>";$0 exit; <= ---8<-----------------------------8<-----------------------------8<--- You get the idea... Regards, Sebastian Ian Barton <[EMAIL PROTECTED]> writes: >> As for using yasnippets with tab, the following successfully binds tab >> to yas/expand when I start emacs with >> >> emacs -Q (skips loading customization) >> >> and then evaluate the following elisp to load yasnippets and org-mode >> >> (load "~/emacs/elisp/util/yasnippet.el") >> (yas/initialize) >> (yas/load-directory "~/emacs/snippets") >> (add-to-list 'load-path "~/emacs/org") >> (require 'org) >> (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))) >> >> This works for me using a fairly recent Emacs 23 from cvs. >> > > Thanks, I have tried that, but it didn't work for me:) I am using Emacs 22.2.1 > (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) > of 2008-09-05 on vernadsky, modified by Ubuntu. I have also tried binding > Yasnippet to the F1 key, which isn't used by anything else. Whilst this works > in > text mode, it doesn't in org mode. > > I'll ask in the Yasnippet list and see if they can suggest anything. > > Ian. > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > -- Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover Tel.: +49 (0)511 - 36 58 472 Fax: +49 (0)1805 - 233633 - 11044 mobil: +49 (0)173 - 83 93 417 Http: www.emma-stil.de _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode