From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Re: [Babel] Macro for begin_src? Date: Sun, 18 Apr 2010 12:50:44 -0400 Message-ID: <87r5mcu2l7.fsf@stats.ox.ac.uk> References: <4BC91BA7.6050904@ccbr.umn.edu> <87eiieuilx.fsf@fastmail.fm> <877ho5jb5g.wl%ucecesf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3Xhu-0007P1-8L for emacs-orgmode@gnu.org; Sun, 18 Apr 2010 12:50:54 -0400 Received: from [140.186.70.92] (port=43113 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3Xhs-0007Or-C2 for emacs-orgmode@gnu.org; Sun, 18 Apr 2010 12:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3Xhq-0002Yj-78 for emacs-orgmode@gnu.org; Sun, 18 Apr 2010 12:50:52 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:39608) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O3Xhp-0002Ya-SN for emacs-orgmode@gnu.org; Sun, 18 Apr 2010 12:50:50 -0400 In-Reply-To: <877ho5jb5g.wl%ucecesf@ucl.ac.uk> (Eric S. Fraga's message of "Sun, 18 Apr 2010 11:41:15 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric S Fraga Cc: Bernt Hansen , Matt Lundin , emacs-orgmode@gnu.org Eric S Fraga writes: > On Sat, 17 Apr 2010 15:55:51 -1000, "Thomas S. Dye" 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: >> > >> > > 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