From: Dan Davison <davison@stats.ox.ac.uk>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: Bernt Hansen <bernt@norang.ca>, Matt Lundin <mdl@imapmail.org>,
emacs-orgmode@gnu.org
Subject: Re: Re: [Babel] Macro for begin_src?
Date: Sun, 18 Apr 2010 12:50:44 -0400 [thread overview]
Message-ID: <87r5mcu2l7.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <877ho5jb5g.wl%ucecesf@ucl.ac.uk> (Eric S. Fraga's message of "Sun, 18 Apr 2010 11:41:15 +0100")
Eric S Fraga <ucecesf@ucl.ac.uk> writes:
> On Sat, 17 Apr 2010 15:55:51 -1000, "Thomas S. Dye" <tsd@tsdye.com> wrote:
>> On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote:
>> > 1. The first and simplest option is built into org-mode. Simply type:
>> >
>> > <s [TAB] or [M-TAB]
>
> Thanks Matt for this. I'd forgotten about the built-in definitions.
> These do make many of my yasnippets superfluous.
>
>> Neat. What would you use yasnippets for, if anything?
>>
>> All the best,
>> Tom
>
> Good question! One case I would still use yasnippets for is more
> complex constructions.
I guess, for Nate's original application (converting existing code to
src blocks), what might have been most useful is something to enclose a
given region in a source block. Can anyone show how to do that with
yasnippet (or anything else)? Or is it best to make a custom function
for a task like this, e.g.
(defun dan/enclose-region-in-src-block ()
(interactive)
(let* ((beg (if (region-active-p) (region-beginning) (point)))
(end (if (region-active-p) (region-end) (point))))
(goto-char end)
(unless (eq (char-before) ?\n) (insert "\n"))
(insert "#+end_src\n")
(goto-char beg)
(beginning-of-line)
(insert "#+begin_src \n")
(backward-char)))
Dan
> For instance, I use tikz a lot for creating
> drawings for teaching. For a given course, many of these drawings are
> similar. One snippet I have is:
>
> #name : tikz
> # --
> #+begin_latex
> \tikzstyle{unit}=[rectangle, draw=blue!80!black, fill=black!5!white]
> \tikzstyle{stream}=[rectangle, draw=white, fill=yellow!50!white]
> \begin{tikzpicture}[node distance=2cm]
> \node[stream] (feed) {Feed};
> \node[unit] (reactor) [right of=feed] {Reactor} edge [<-] (feed);
> \node[unit] (separator) [right of=reactor] {Separation} edge [<-] (reactor);
> $0
> \end{tikzpicture}
> #+end_latex
>
> Before Carsten implemented the beamer option in org-mode, I also had a
> snippet for setting up columns with blocks in org-mode for my custom
> beamer setup I used to have.
>
>
> _______________________________________________
> 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
next prev parent reply other threads:[~2010-04-18 16:50 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
2010-04-18 10:41 ` Eric S Fraga
2010-04-18 16:50 ` Dan Davison [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r5mcu2l7.fsf@stats.ox.ac.uk \
--to=davison@stats.ox.ac.uk \
--cc=bernt@norang.ca \
--cc=e.fraga@ucl.ac.uk \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.