emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Thomas S. Dye" <tsd@tsdye.com>
To: Matt Lundin <mdl@imapmail.org>
Cc: Bernt Hansen <bernt@norang.ca>, emacs-orgmode@gnu.org
Subject: Re: Re: [Babel] Macro for begin_src?
Date: Sat, 17 Apr 2010 15:55:51 -1000	[thread overview]
Message-ID: <E6FAA3A5-8EC8-4674-A56F-0AD9268EEC08@tsdye.com> (raw)
In-Reply-To: <87eiieuilx.fsf@fastmail.fm>


On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote:

> Erik Iverson <eriki@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

  reply	other threads:[~2010-04-18  1:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-17  1:18 [Babel] Macro for begin_src? Nathan Neff
2010-04-17  1:32 ` Nathan Neff
2010-04-17  2:23   ` Erik Iverson
2010-04-17 10:12     ` Eric S Fraga
2010-04-17 13:38       ` Nathan Neff
2010-04-18  1:01         ` Shelagh Manton
2010-04-18 10:44           ` Eric S Fraga
2010-04-19  0:24             ` Shelagh Manton
2010-04-19  2:06               ` Bernt Hansen
2010-04-19  8:33               ` Eric S Fraga
2010-04-19 11:05               ` Sebastian Rose
2010-04-20  9:19       ` Sébastien Vauban
2010-04-20 10:27         ` [OT] " Eric S Fraga
2010-04-20 14:48         ` Eric Schulte
2010-10-17 16:56           ` Rainer M Krug
2010-10-17 17:10             ` Eric Schulte
2010-10-18 15:02               ` Sébastien Vauban
2010-10-18 15:42                 ` Dan Davison
2010-10-18 21:01                   ` Sébastien Vauban
2010-10-18 16:50                 ` Greg Troxel
2010-04-17 16:52     ` Matt Lundin
2010-04-18  1:55       ` Thomas S. Dye [this message]
2010-04-18 10:41         ` Eric S Fraga
2010-04-18 16:50           ` Dan Davison
2010-04-18 20:13             ` Štěpán Němec
2010-04-18 20:25               ` Eric S Fraga
2010-04-17  2:35   ` Dan Davison
2010-04-17  3:43     ` Nathan Neff
2010-04-17  3:55       ` Dan Davison
2010-04-17 11:03         ` Štěpán Němec
2010-04-17 13:56           ` Nathan Neff
2010-04-17 14:06             ` Erik Iverson
2010-04-17 14:28               ` Nathan Neff
2010-04-17 15:05                 ` Eric Schulte
2010-04-17  1:34 ` Thomas S. Dye
2010-04-17  1:37 ` Bernt Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E6FAA3A5-8EC8-4674-A56F-0AD9268EEC08@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=mdl@imapmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).