From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thomas S. Dye" Subject: Re: Re: [Babel] Macro for begin_src? Date: Sat, 17 Apr 2010 15:55:51 -1000 Message-ID: References: <4BC91BA7.6050904@ccbr.umn.edu> <87eiieuilx.fsf@fastmail.fm> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3Jjv-0003zn-H9 for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 21:56:03 -0400 Received: from [140.186.70.92] (port=51061 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3Jjs-0003zd-Iu for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 21:56:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3Jjq-0006dg-Lm for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 21:56:00 -0400 Received: from oproxy2-pub.bluehost.com ([66.147.249.254]:39536 helo=outbound-mail-360.bluehost.com) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1O3Jjq-0006dR-Eh for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 21:55:58 -0400 In-Reply-To: <87eiieuilx.fsf@fastmail.fm> 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: Matt Lundin Cc: Bernt Hansen , emacs-orgmode@gnu.org On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote: > Erik Iverson 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: > > > 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