<p>Particularly, what is the best snippets package out there?</p>

<p>Features:</p>

<ul>
<li>easy to define new snippets (plain text, custom input with defaults)</li>
<li>simple navigation between predefined positions in the snippet</li>
<li>multiple insertion of the same custom input</li>
<li>accepts currently selected text as a custom input</li>
<li><em>cross-platform</em> (Windows, Linux)</li>
<li>dynamically evaluated expressions (embedded code) written in a concise programming language (Perl, Python, Ruby are preferred)</li>
<li>nicely coexists with others packages in Emacs</li>
</ul>

<p>Example of code template, a simple <code>for</code> loop in C:</p>

<pre><code>for (int i = 0; i &lt; %N%; ++i) {
  _
}
</code></pre>

<p>It is a lot of typing for such common code. I want to invoke a code template or snippet which inserts
that boilerplate code for me. Additionally it stops (on TAB or other keystroke) at <code>%N%</code> (my input replaces it) and final position of the cursor is <code>_</code>. </p>

[{'answer_id': 61447, 'author': 'jfs', 'author_id': 4279, 'author_profile': 'https://Stackoverflow.com/users/4279', 'pm_score': 6, 'selected': True, 'text': '<p><a href="http://manual.macromates.com/en/snippets" rel="nofollow noreferrer">TextMate\'s snippets</a> is the most closest match but it is not a cross-platform solution and not for Emacs.</p>\n<p>The second closest thing is <a href="http://github.com/joaotavora/yasnippet/" rel="nofollow noreferrer" title="Yet Another Snippet Package for Emacs">YASnippet</a> (<a href="http://www.youtube.com/watch?v=vOj7btx3ATg" rel="nofollow noreferrer" title="yasnippet screencast">screencast</a> shows the main capabilities). But it interferes with <code>hippie-expand</code> package in my setup and the embedded language is EmacsLisp which I\'m not comfortable with outside <code>.emacs</code>.</p>\n<p><strong>EDIT</strong>: Posted my answer here to allow voting on <code>YASnippet</code>.</p>\n'}, {'answer_id': 64249, 'author': 'cjm', 'author_id': 8355, 'author_profile': 'https://Stackoverflow.com/users/8355', 'pm_score': 3, 'selected': False, 'text': '<p>Personally, I\'ve been using Dmacro for years (<a href="ftp://ftp.sgi.com/other/dmacro/dmacro.tar.gz" rel="noreferrer">ftp://ftp.sgi.com/other/dmacro/dmacro.tar.gz</a>).</p>\n\n<p>Here\'s a review of it that also mentions some alternatives: <a href="http://linuxgazette.net/issue39/marsden.html" rel="noreferrer">http://linuxgazette.net/issue39/marsden.html</a></p>\n'}, {'answer_id': 69580, 'author': 'Joe Hildebrand', 'author_id': 8388, 'author_profile': 'https://Stackoverflow.com/users/8388', 'pm_score': 2, 'selected': False, 'text': '<p>The EmacsWiki has a <a href="http://www.emacswiki.org/cgi-bin/wiki/CategoryTemplates" rel="nofollow noreferrer">page of template engines</a>.</p>\n\n<p>Of these, I\'ve used <a href="http://www.emacswiki.org/cgi-bin/wiki/TempoMode" rel="nofollow noreferrer">tempo</a> in the (distant) past to add table support to <a href="http://www.nongnu.org/baol-hth/" rel="nofollow noreferrer">html-helper-mode</a>, but don\'t know how it has progressed in the last 15 years.</p>\n'}, {'answer_id': 732258, 'author': 'l0st3d', 'author_id': 5100, 'author_profile': 'https://Stackoverflow.com/users/5100', 'pm_score': 2, 'selected': False, 'text': '<p>I\'d add my vote for <a href="http://www.emacswiki.org/emacs/TempoSnippets" rel="nofollow noreferrer">tempo snippets</a> ... easy to setup, powerful (you can run arbitrary elisp in your template - so that you can downcase things, lookup filenames &amp; classes, count things, etc), set the indentation, integrate with abbrevs ... I use it a lot ;)</p>\n'}, {'answer_id': 18829042, 'author': 'gavenkoa', 'author_id': 173149, 'author_profile': 'https://Stackoverflow.com/users/173149', 'pm_score': 2, 'selected': False, 'text': '<p>I vote for <a href="http://cedet.sourceforge.net/srecode.shtml" rel="nofollow noreferrer">http://cedet.sourceforge.net/srecode.shtml</a></p>\n<p>It has very clean syntax and has access to code environment through <code>Semantic</code>.</p>\n<p>Also it is a part of a large well supported <code>CEDET</code> distribution (which was built into Emacs for 24.x version series).</p>\n<p><strong>UPDATE</strong> <a href="https://github.com/joaotavora/yasnippet" rel="nofollow noreferrer">YASnippet</a> is also a powerful template engine. But it uses an ugly file naming schema (your file name === template name) for you can\'t put several templates into a single file and have issues with national character sets...</p>\n'}, {'answer_id': 50163924, 'author': 'Jiahao', 'author_id': 9737937, 'author_profile': 'https://Stackoverflow.com/users/9737937', 'pm_score': 1, 'selected': False, 'text': '<p>You can try a lightweight solution <a href="https://github.com/jiahaowork/muban.el" rel="nofollow noreferrer">muban.el</a></p>\n\n<p>It is written completely in Elisp and has a very simple syntax.</p>\n'}]
['https://Stackoverflow.com/questions/61446', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4279/']