From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: [Babel] Macro for begin_src? Date: Sat, 17 Apr 2010 12:52:26 -0400 Message-ID: <87eiieuilx.fsf@fastmail.fm> References: <4BC91BA7.6050904@ccbr.umn.edu> 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 1O3BE2-0000ib-Mp for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 12:50:34 -0400 Received: from [140.186.70.92] (port=39737 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3BE1-0000fg-CF for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 12:50:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3BDz-0002FW-5N for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 12:50:33 -0400 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:55741) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O3BDz-0002FS-30 for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 12:50:31 -0400 In-Reply-To: <4BC91BA7.6050904@ccbr.umn.edu> (Erik Iverson's message of "Fri, 16 Apr 2010 21:23:35 -0500") 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: Erik Iverson Cc: Bernt Hansen , emacs-orgmode@gnu.org 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: 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