On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote:
Erik Iverson <er...@ccbr.umn.edu> writes:
http://doc.norang.ca/org-mode.html#Yasnippets
If anyone else has a different macro set up, I'm still interested in
hearing your solutions.
Nope, yasnippet is the way to go I think!
There are quite a few other options. IMO, installing yasnippet is
overkill if you are only using it for comment blocks in org-mode.
1. The first and simplest option is built into org-mode. Simply type:
<s [TAB] or [M-TAB]
This will automatically expand to:
--8<---------------cut here---------------start------------->8---
#+begin_src
#+end_src
--8<---------------cut here---------------end--------------->8---
For a full list of completions, type "C-h v
org-structure-template-alist".
2. The second option is to save the text to a register:
(set-register ?b "#+begin_src\n\n#+end_src")
Then type C-x r i b to insert the source block.
(info "(emacs) Registers")
3. You can use abbrev mode for dynamic expansion:
- Activate the abbrev minor-mode in org-mode:
+ M-x abbrev-mode
+ permanently: (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))
- In org-mode, type something like "sbp" for a perl source block.
- Immediately after "sbp" type C-x a i l.
- Enter the expansion: #+begin_src perl[C-q C-j][C-q C-j]#+end_src
+ Note: the C-q C-j creates a new line in the minibuffer
- Now, whenever, you type sbp[Space, RET, TAB, etc.] in an org-mode
buffer, the src block will magically appear.
- If you want more complex completion (like yasnippet) you can combine
abbrev mode with skeletons.
See:
- (info "(emacs) Abbrevs") and
- http://www.emacswiki.org/emacs/SkeletonMode
Best,
Matt
Neat. What would you use yasnippets for, if anything?
All the best,
Tom
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode