Changes between Initial Version and Version 1 of EmacsSnippetSupport


Ignore:
Timestamp:
11/23/08 22:31:40 (14 years ago)
Author:
desai
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • EmacsSnippetSupport

    v1 v1  
     1= Using Bcfg2 with Emacs + YASnippet mode =  
     2 
     3This page describes using emacs with YASnippet mode with a set of snippets that allow quick composition of bundles. More snippets are under development.  
     4 
     5 1. Download YASnippet from http://code.google.com/p/yasnippet/  
     6 1. Install it into your emacs load path (typically ~/.emacs.d/site-lisp) 
     7 1. Add YASnippet initialization to your .emacs (remember to re-byte-compile it if needed) 
     8{{{ 
     9(require 'yasnippet-bundle) 
     10(yas/define-snippets 'sgml-mode 
     11'( 
     12  ("<Bundle" "<Bundle name='${1:bundlename}' version='2.0'> 
     13   $0 
     14</Bundle>" nil) 
     15  ("<Group" "<Group name='${1:groupname}> 
     16   $0 
     17</Group>" nil) 
     18  ("<Config" "<ConfigFile name='${1:filename}'/> 
     19$0" nil) 
     20  ("<Service" "<Service name='${1:svcname}'/> 
     21$0" nil) 
     22  ("<Package" "<Package name='${1:packagename}'/> 
     23$0" nil) 
     24  ("<Action" "<Action name='${1:name}'/> 
     25$0" nil) 
     26  ("<Directory" "<Directory name='${1:name}'/> 
     27$0" nil) 
     28  ("<SymLink" "<SymLink name='${1:name}'/> 
     29$0" nil) 
     30  ("<Permissions" "<Permissions name='${1:name}'/> 
     31$0" nil) 
     32) 
     33) 
     34}}} 
     35 1. One quick M-x eval-current-buffer, and this code is enabled 
     36 
     37Each of these snippets activates on the opening element, ie <Bundle. After this string is entered, but before entering a space, press <TAB>, and the snippet will be expanded. The template will be inserted into the text with a set of input prompts, which default to overwrite mode and can be tabbed through.  
     38 
     39The code above only works for bundles, but will be expanded to support base and other xml files as well.