summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimeon Simeonov2013-09-19 22:27:58 +0200
committerSimeon Simeonov2013-09-19 22:27:58 +0200
commit7bf6712498ad2618bee7bf5b3866fb6da0772339 (patch)
treefd4d959c0f1679f2abf5663399d68df0a06472de
parentb045e27c545d4027811637193632ec3ea5ef7858 (diff)
All snippets imported, init file polished
-rw-r--r--.emacs80
-rw-r--r--.emacs.d/lisp/yasnippet.el3676
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/beginend3
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/class8
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/ns3
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/template3
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/using4
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/c-mode/fopen3
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/c-mode/printf6
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib7
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.121
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.221
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/class21
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment6
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.14
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.24
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.34
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/method10
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/namespace7
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/prop16
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/region6
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using4
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.14
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.24
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/do6
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/for6
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/if6
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/inc3
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/inc.13
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/main7
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/objc-mode/prop13
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/once8
-rw-r--r--.emacs.d/mysnippets/text-mode/cc-mode/struct6
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/bg3
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/bg.13
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/bor3
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/cl4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/disp.block4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/disp.inline4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/disp.none4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/ff4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/fs4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/mar.bottom4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/mar.left4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/mar.mar4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/mar.margin4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/mar.right4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/mar.top4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/pad.bottom4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/pad.left4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/pad.pad4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/pad.padding4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/pad.right4
-rw-r--r--.emacs.d/mysnippets/text-mode/css-mode/pad.top4
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/.read_me11
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/defun11
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/dired.process_marked16
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.process17
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.read-lines17
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace17
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabstring4
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabthing4
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/traverse_dir6
-rw-r--r--.emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region27
-rw-r--r--.emacs.d/mysnippets/text-mode/email3
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/after4
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/begin5
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/beh4
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/case5
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/compile4
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/def4
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/exp5
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/fun3
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/if6
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/ifdef5
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/ifndef5
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/imp5
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/inc4
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/inc.lib4
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/loop8
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/mod6
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/rcv5
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/rcv.after6
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/rec4
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/try7
-rw-r--r--.emacs.d/mysnippets/text-mode/erlang-mode/undef4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/au4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/bd4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/c4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/ch4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/cx4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/dc4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/do6
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/dp4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/eq4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/ib4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/ic4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/ich4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/if6
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/ii4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/il4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/in4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/inc4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/intr4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/ir4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/l4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/pa4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/pr6
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/re4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/st4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/su4
-rw-r--r--.emacs.d/mysnippets/text-mode/f90-mode/wr4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/body6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/br4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/code6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/code.class6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/dd5
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/div3
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/div.class6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/div.id6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/div.id-class6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/dl7
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/dl.id7
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/doctype4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/doctype.xhml14
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_14
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_strict4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_transitional4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/dov11
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/dt5
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/form6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/h15
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/h25
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/h35
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/h45
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/h55
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/h65
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/head6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/hr4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/href4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/html6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/html.xmlns6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/img4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/input4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/li5
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/li.class5
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/link.stylesheet4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/link.stylesheet-ie6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/mailto4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/meta5
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/meta.http-equiv5
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/ol7
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/ol.class7
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/ol.id7
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/p4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/pre6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/quote6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/script.javascript6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/script.javascript-src4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/span4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/span.class4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/span.id4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/style6
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/table7
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/td5
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/textarea4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/th5
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/title4
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/tr7
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/ul7
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/ul.class7
-rw-r--r--.emacs.d/mysnippets/text-mode/html-mode/ul.id7
-rw-r--r--.emacs.d/mysnippets/text-mode/latex-mode/begin7
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/+5
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/-5
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/_4
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/__4
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/`4
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/h1.16
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/h1.27
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/h2.16
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/h2.27
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/h36
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/h46
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/h56
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/h66
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/hr.17
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/hr.27
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/img4
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/link4
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/ol5
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/rimg4
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/rlb5
-rw-r--r--.emacs.d/mysnippets/text-mode/markdown-mode/rlink4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/body6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/br4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/code6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/div4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/doctype5
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_strict5
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_transitional5
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/form6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/h15
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/h25
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/h35
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/h45
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/h55
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/h65
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/head6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/hr4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/href4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/html6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/img4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/input4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/li4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/link4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/meta5
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/name4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/ol6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/p4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/pre6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/quote6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/span4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/style6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/table6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/tag.1l4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/tag.2l6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/td4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/th4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/title4
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/tr6
-rw-r--r--.emacs.d/mysnippets/text-mode/nxml-mode/ul6
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/eval8
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/for5
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/fore5
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/if5
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/ife7
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/ifee9
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/sub5
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/unless5
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/while5
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/xfore3
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/xif3
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/xunless3
-rw-r--r--.emacs.d/mysnippets/text-mode/perl-mode/xwhile3
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/__3
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/class54
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/def35
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/defm33
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/for4
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/ifmain4
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/prop15
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/propg9
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/propsg12
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/while4
-rw-r--r--.emacs.d/mysnippets/text-mode/rst-mode/chap6
-rw-r--r--.emacs.d/mysnippets/text-mode/rst-mode/sec6
-rw-r--r--.emacs.d/mysnippets/text-mode/rst-mode/tit7
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/#4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/=b6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/Comp8
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/all4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/am4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/any4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/app6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/bm6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/case7
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/cla6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/classify4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/cls13
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/collect4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/dee4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/deli4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/det4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/dow6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/ea4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/eac4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/eai4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/eav4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/eawi4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/forin6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/if6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/ife8
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/inject4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/mm6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/r4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/rb4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/reject4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/req4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/rreq4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/rw4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/select4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/tim4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/until6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/upt6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/w4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/when6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/while6
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/y4
-rw-r--r--.emacs.d/mysnippets/text-mode/ruby-mode/zip4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/act10
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/act.arg10
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/actor10
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/ano4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/app6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/arr.new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/arr.val-new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/asof4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/ass4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/ass.true4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/at.author4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/at.param4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/at.return4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/at.version4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/bang4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/case4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/case.match-all4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/cast4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/cc4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/cl6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/cl.abs6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/cl.abs-arg6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/cl.arg6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/clof4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/co4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/cons4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/cons.nil4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/def.arg4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/def.arg-body6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret-body6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/def.body6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/def.ret4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/def.ret-body6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/def.simple4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/doc.class8
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/doc.def6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/doc.file9
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala16
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala-api16
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/doc.scaladoc7
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/expect6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/ext4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/for.extract4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/for.if6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/for.loop6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/for.multi9
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/foreach4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/hmap.new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/hmap.val-new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/hset.new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/hset.val-new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/if6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/if.else8
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/imp4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/intercept6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/isof4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/ls.new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/ls.val-new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/main6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/map4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/map.new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/match6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/match.can11
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/match.option8
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/mix6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/ob4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/pac4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/pr.newline4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/pr.simple4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/pr.string4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/pr.trace4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/pri4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/pri.param4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/pro4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/pro.param4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/suite8
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/test7
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/throw4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/tr6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/tr.ext6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/tr.ext-with6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/tr.with6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/try9
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/try.catch-finally11
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/try.finally8
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/tup.arrow4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/tup.paren4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/val4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/val.new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/val.ret4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/var4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/var.new4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/var.ret4
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/whi6
-rw-r--r--.emacs.d/mysnippets/text-mode/scala-mode/with4
-rw-r--r--.emacs.d/mysnippets/text-mode/snippet-mode/field5
-rw-r--r--.emacs.d/mysnippets/text-mode/snippet-mode/mirror5
-rw-r--r--.emacs.d/mysnippets/text-mode/snippet-mode/vars9
-rw-r--r--.emacs.d/mysnippets/text-mode/sql-mode/column4
-rw-r--r--.emacs.d/mysnippets/text-mode/sql-mode/constraint4
-rw-r--r--.emacs.d/mysnippets/text-mode/sql-mode/constraint.14
-rw-r--r--.emacs.d/mysnippets/text-mode/sql-mode/create10
-rw-r--r--.emacs.d/mysnippets/text-mode/sql-mode/create.112
-rw-r--r--.emacs.d/mysnippets/text-mode/sql-mode/references4
-rw-r--r--.emacs.d/mysnippets/text-mode/time3
406 files changed, 6050 insertions, 44 deletions
diff --git a/.emacs b/.emacs
index b6b1f57..3f7c28b 100644
--- a/.emacs
+++ b/.emacs
@@ -3,78 +3,70 @@
3;; under X, instead of the default, backspace behavior. 3;; under X, instead of the default, backspace behavior.
4(global-set-key [delete] 'delete-char) 4(global-set-key [delete] 'delete-char)
5(global-set-key [kp-delete] 'delete-char) 5(global-set-key [kp-delete] 'delete-char)
6;;(global-set-key (read-kbd-macro "C-c <") 'end-of-buffer)
7(global-set-key [f1] 'comment-region)
8(global-set-key [f2] 'uncomment-region)
9;;(global-set-key "C-<<" 'end-of-buffer)
10
11 6
12;; My own key bindings ;; 7;; My own key bindings ;;
13;;(global-set-key [f1] 'compile) 8;;(global-set-key [f1] 'compile)
14;;(global-set-key [f2] 'delete-other-windows)
15
16 9
17;; Turn on font-lock mode for Emacs 10;; Turn on font-lock mode for Emacs
18(global-font-lock-mode t) 11(global-font-lock-mode t)
19 12
13;; custom-set-faces was added by Custom.
14;; If you edit it by hand, you could mess it up, so be careful.
15;; Your init file should contain only one such instance.
16;; If there is more than one, they won't work right.
17(custom-set-faces
18 '(font-lock-comment-face ((nil (:foreground "red")))))
20 19
21
22;; Always end a file with a newline
23;;(setq require-final-newline t) 20;;(setq require-final-newline t)
24(setq require-final-newline nil) 21(setq require-final-newline nil)
25 22;; Stop at the end of the file, not just add lines
26 23(setq next-line-add-newlines nil)
27(setq auto-save-default nil)
28(setq default-tab-width 4)
29(setq make-backup-files nil)
30 24
31;; Display columns 25;; Display columns
32(setq column-number-mode t) 26(setq column-number-mode t)
33
34(setq inhibit-splash-screen t) 27(setq inhibit-splash-screen t)
35 28
36;; indent to spaces only 29;; vim-Scroll
37(setq-default indent-tabs-mode nil) 30(setq scroll-conservatively 1)
38
39;; Stop at the end of the file, not just add lines
40(setq next-line-add-newlines nil)
41
42
43;; Customized font-lock-comment-face
44(custom-set-variables
45 ;; custom-set-variables was added by Custom.
46 ;; If you edit it by hand, you could mess it up, so be careful.
47 ;; Your init file should contain only one such instance.
48 ;; If there is more than one, they won't work right.
49 )
50(custom-set-faces
51 ;; custom-set-faces was added by Custom.
52 ;; If you edit it by hand, you could mess it up, so be careful.
53 ;; Your init file should contain only one such instance.
54 ;; If there is more than one, they won't work right.
55 '(font-lock-comment-face ((nil (:foreground "red")))))
56 31
32;; Various
33(setq auto-save-default nil)
34(setq make-backup-files nil)
57 35
58;; Needed in Ubuntu 36;; UTF-8 support (legacy workaround for Ubuntu)
59(set-default-coding-systems 'utf-8) 37(set-default-coding-systems 'utf-8)
60(set-terminal-coding-system 'utf-8) 38(set-terminal-coding-system 'utf-8)
61(set-keyboard-coding-system 'utf-8) 39(set-keyboard-coding-system 'utf-8)
62 40
63;; vim-Scroll
64(setq scroll-conservatively 1)
65 41
42;; Programming section
66 43
67;; (require 'pymacs) 44;; Indentation
68;; (pymacs-load "ropemacs" "rope-") 45(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil)
69;; (setq ropemacs-enable-autoimport t)
70 46
47;; Default coding style
48(setq c-default-style "bsd")
71 49
72;; (yas/initialize) 50;; yasnippet
51(yas/initialize)
73;; (setq yas/root-directory '("~/.emacs.d/mysnippets" 52;; (setq yas/root-directory '("~/.emacs.d/mysnippets"
74;; "/usr/share/emacs/site-lisp/yasnippet/snippets")) 53;; "/usr/share/emacs/site-lisp/yasnippet/snippets"))
75;; (mapc 'yas/load-directory yas/root-directory) 54;; (mapc 'yas/load-directory yas/root-directory)
76(yas/load-directory "~/.emacs.d/mysnippets") 55(yas/load-directory "~/.emacs.d/mysnippets")
77 56
78 57
79(setq c-default-style "bsd" 58;; Python stuff
80 c-basic-offset 2) 59
60;; Don't attempt to guess the indent
61(setq python-indent-guess-indent-offset nil)
62
63;; (require 'pymacs)
64;; (pymacs-load "ropemacs" "rope-")
65;; (setq ropemacs-enable-autoimport t)
66
67
68;; CUA mode
69;;(cua-mode t)
70;;(setq cua-auto-tabify-rectangles nil)
71;;(transient-mark-mode 1)
72;;(cua-selection-mode t)
diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el
new file mode 100644
index 0000000..fcbce9e
--- /dev/null
+++ b/.emacs.d/lisp/yasnippet.el
@@ -0,0 +1,3676 @@
1;;; Yasnippet.el --- Yet another snippet extension for Emacs.
2
3;; Copyright 2008 pluskid
4;; 2009 pluskid, joaotavora
5
6;; Authors: pluskid <pluskid@gmail.com>, joaotavora <joaotavora@gmail.com>
7;; Version: 0.6.1
8;; Package-version: 0.6.1c
9;; X-URL: http://code.google.com/p/yasnippet/
10;; Keywords: convenience, emulation
11;; URL: http://code.google.com/p/yasnippet/
12;; EmacsWiki: YaSnippetMode
13
14;; This file is free software; you can redistribute it and/or modify
15;; it under the terms of the GNU General Public License as published by
16;; the Free Software Foundation; either version 2, or (at your option)
17;; any later version.
18
19;; This file is distributed in the hope that it will be useful,
20;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;; GNU General Public License for more details.
23
24;; You should have received a copy of the GNU General Public License
25;; along with GNU Emacs; see the file COPYING. If not, write to
26;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27;; Boston, MA 02111-1307, USA.
28
29;;; Commentary:
30
31;; Basic steps to setup:
32;;
33;; 1. In your .emacs file:
34;; (add-to-list 'load-path "/dir/to/yasnippet.el")
35;; (require 'yasnippet)
36;; 2. Place the `snippets' directory somewhere. E.g: ~/.emacs.d/snippets
37;; 3. In your .emacs file
38;; (setq yas/root-directory "~/.emacs/snippets")
39;; (yas/load-directory yas/root-directory)
40;; 4. To enable the YASnippet menu and tab-trigger expansion
41;; M-x yas/minor-mode
42;; 5. To globally enable the minor mode in *all* buffers
43;; M-x yas/global-mode
44;;
45;; Steps 4. and 5. are optional, you don't have to use the minor
46;; mode to use YASnippet.
47;;
48;; Interesting variables are:
49;;
50;; `yas/root-directory'
51;;
52;; The directory where user-created snippets are to be
53;; stored. Can also be a list of directories that
54;; `yas/reload-all' will use for bulk-reloading snippets. In
55;; that case the first directory the default for storing new
56;; snippets.
57;;
58;; `yas/mode-symbol'
59;;
60;; A local variable that you can set in a hook to override
61;; snippet-lookup based on major mode. It is a a symbol (or
62;; list of symbols) that correspond to subdirectories of
63;; `yas/root-directory' and is used for deciding which
64;; snippets to consider for the active buffer.
65;;
66;; Major commands are:
67;;
68;; M-x yas/expand
69;;
70;; Try to expand snippets before point. In `yas/minor-mode',
71;; this is bound to `yas/trigger-key' which you can customize.
72;;
73;; M-x yas/load-directory
74;;
75;; Prompts you for a directory hierarchy of snippets to load.
76;;
77;; M-x yas/insert-snippet
78;;
79;; Prompts you for possible snippet expansion if that is
80;; possible according to buffer-local and snippet-local
81;; expansion conditions. With prefix argument, ignore these
82;; conditions.
83;;
84;; M-x yas/find-snippets
85;;
86;; Lets you find the snippet files in the correct
87;; subdirectory of `yas/root-directory', according to the
88;; active major mode (if it exists) like
89;; `find-file-other-window'.
90;;
91;; M-x yas/visit-snippet-file
92;;
93;; Prompts you for possible snippet expansions like
94;; `yas/insert-snippet', but instead of expanding it, takes
95;; you directly to the snippet definition's file, if it
96;; exists.
97;;
98;; M-x yas/new-snippet
99;;
100;; Lets you create a new snippet file in the correct
101;; subdirectory of `yas/root-directory', according to the
102;; active major mode.
103;;
104;; M-x yas/load-snippet-buffer
105;;
106;; When editing a snippet, this loads the snippet. This is
107;; bound to "C-c C-c" while in the `snippet-mode' editing
108;; mode.
109;;
110;; M-x yas/tryout-snippet
111;;
112;; When editing a snippet, this opens a new empty buffer,
113;; sets it to the appropriate major mode and inserts the
114;; snippet there, so you can see what it looks like. This is
115;; bound to "C-c C-t" while in `snippet-mode'.
116;;
117;; The `dropdown-list.el' extension is bundled with YASnippet, you
118;; can optionally use it the preferred "prompting method", puting in
119;; your .emacs file, for example:
120;;
121;; (require 'dropdown-list)
122;; (setq yas/prompt-functions '(yas/dropdown-prompt
123;; yas/ido-prompt
124;; yas/completing-prompt))
125;;
126;; Also check out the customization group
127;;
128;; M-x customize-group RET yasnippet RET
129;;
130;; If you use the customization group to set variables
131;; `yas/root-directory' or `yas/global-mode', make sure the path to
132;; "yasnippet.el" is present in the `load-path' *before* the
133;; `custom-set-variables' is executed in your .emacs file.
134;;
135;; For more information and detailed usage, refer to the project page:
136;; http://code.google.com/p/yasnippet/
137
138;;; Code:
139
140(require 'cl)
141(require 'assoc)
142(require 'easymenu)
143
144
145;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
146;; User customizable variables
147
148
149(defgroup yasnippet nil
150 "Yet Another Snippet extension"
151 :group 'editing)
152
153;;;###autoload
154(defcustom yas/root-directory nil
155 "Root directory that stores the snippets for each major mode.
156
157If you set this from your .emacs, can also be a list of strings,
158for multiple root directories. If you make this a list, the first
159element is always the user-created snippets directory. Other
160directories are used for bulk reloading of all snippets using
161`yas/reload-all'"
162 :type '(choice (string :tag "Single directory (string)")
163 (repeat :args (string) :tag "List of directories (strings)"))
164 :group 'yasnippet
165 :require 'yasnippet
166 :set #'(lambda (symbol new)
167 (let ((old (and (boundp symbol)
168 (symbol-value symbol))))
169 (set-default symbol new)
170 (unless (or (not (fboundp 'yas/reload-all))
171 (equal old new))
172 (yas/reload-all)))))
173
174(defcustom yas/prompt-functions '(yas/x-prompt
175 yas/dropdown-prompt
176 yas/completing-prompt
177 yas/ido-prompt
178 yas/no-prompt)
179 "Functions to prompt for keys, templates, etc interactively.
180
181These functions are called with the following arguments:
182
183- PROMPT: A string to prompt the user
184
185- CHOICES: a list of strings or objects.
186
187- optional DISPLAY-FN : A function that, when applied to each of
188the objects in CHOICES will return a string.
189
190The return value of any function you put here should be one of
191the objects in CHOICES, properly formatted with DISPLAY-FN (if
192that is passed).
193
194- To signal that your particular style of prompting is
195unavailable at the moment, you can also have the function return
196nil.
197
198- To signal that the user quit the prompting process, you can
199signal `quit' with
200
201 (signal 'quit \"user quit!\")."
202 :type '(repeat function)
203 :group 'yasnippet)
204
205(defcustom yas/indent-line 'auto
206 "Controls indenting applied to a recent snippet expansion.
207
208The following values are possible:
209
210- `fixed' Indent the snippet to the current column;
211
212- `auto' Indent each line of the snippet with `indent-according-to-mode'
213
214Every other value means don't apply any snippet-side indendation
215after expansion (the manual per-line \"$>\" indentation still
216applies)."
217 :type '(choice (const :tag "Nothing" nothing)
218 (const :tag "Fixed" fixed)
219 (const :tag "Auto" auto))
220 :group 'yasnippet)
221
222(defcustom yas/also-auto-indent-first-line nil
223 "Non-nil means also auto indent first line according to mode.
224
225Naturally this is only valid when `yas/indent-line' is `auto'"
226 :type 'boolean
227 :group 'yasnippet)
228
229(defcustom yas/snippet-revival t
230 "Non-nil means re-activate snippet fields after undo/redo."
231 :type 'boolean
232 :group 'yasnippet)
233
234(defcustom yas/trigger-key "TAB"
235 "The key bound to `yas/expand' when function `yas/minor-mode' is active.
236
237Value is a string that is converted to the internal Emacs key
238representation using `read-kbd-macro'."
239 :type 'string
240 :group 'yasnippet
241 :set #'(lambda (symbol key)
242 (let ((old (and (boundp symbol)
243 (symbol-value symbol))))
244 (set-default symbol key)
245 ;; On very first loading of this defcustom,
246 ;; `yas/trigger-key' is *not* loaded.
247 (if (fboundp 'yas/trigger-key-reload)
248 (yas/trigger-key-reload old)))))
249
250(defcustom yas/next-field-key '("TAB" "<tab>")
251 "The key to navigate to next field when a snippet is active.
252
253Value is a string that is converted to the internal Emacs key
254representation using `read-kbd-macro'.
255
256Can also be a list of strings."
257 :type '(choice (string :tag "String")
258 (repeat :args (string) :tag "List of strings"))
259 :group 'yasnippet
260 :set #'(lambda (symbol val)
261 (set-default symbol val)
262 (if (fboundp 'yas/init-yas-in-snippet-keymap)
263 (yas/init-yas-in-snippet-keymap))))
264
265
266(defcustom yas/prev-field-key '("<backtab>" "<S-tab>")
267 "The key to navigate to previous field when a snippet is active.
268
269Value is a string that is converted to the internal Emacs key
270representation using `read-kbd-macro'.
271
272Can also be a list of strings."
273 :type '(choice (string :tag "String")
274 (repeat :args (string) :tag "List of strings"))
275 :group 'yasnippet
276 :set #'(lambda (symbol val)
277 (set-default symbol val)
278 (if (fboundp 'yas/init-yas-in-snippet-keymap)
279 (yas/init-yas-in-snippet-keymap))))
280
281(defcustom yas/skip-and-clear-key "C-d"
282 "The key to clear the currently active field.
283
284Value is a string that is converted to the internal Emacs key
285representation using `read-kbd-macro'.
286
287Can also be a list of strings."
288 :type '(choice (string :tag "String")
289 (repeat :args (string) :tag "List of strings"))
290 :group 'yasnippet
291 :set #'(lambda (symbol val)
292 (set-default symbol val)
293 (if (fboundp 'yas/init-yas-in-snippet-keymap)
294 (yas/init-yas-in-snippet-keymap))))
295
296(defcustom yas/triggers-in-field nil
297 "If non-nil, `yas/next-field-key' can trigger stacked expansions.
298
299Otherwise, `yas/next-field-key' just tries to move on to the next
300field"
301 :type 'boolean
302 :group 'yasnippet)
303
304(defcustom yas/fallback-behavior 'call-other-command
305 "How to act when `yas/trigger-key' does *not* expand a snippet.
306
307- `call-other-command' means try to temporarily disable YASnippet
308 and call the next command bound to `yas/trigger-key'.
309
310- nil or the symbol `return-nil' mean do nothing. (and
311 `yas/expand-returns' nil)
312
313- A lisp form (apply COMMAND . ARGS) means interactively call
314 COMMAND, if ARGS is non-nil, call COMMAND non-interactively
315 with ARGS as arguments."
316 :type '(choice (const :tag "Call previous command" call-other-command)
317 (const :tag "Do nothing" return-nil))
318 :group 'yasnippet)
319(make-variable-buffer-local 'yas/fallback-behavior)
320
321(defcustom yas/choose-keys-first nil
322 "If non-nil, prompt for snippet key first, then for template.
323
324Otherwise prompts for all possible snippet names.
325
326This affects `yas/insert-snippet' and `yas/visit-snippet-file'."
327 :type 'boolean
328 :group 'yasnippet)
329
330(defcustom yas/choose-tables-first nil
331 "If non-nil, and multiple eligible snippet tables, prompts user for tables first.
332
333Otherwise, user chooses between the merging together of all
334eligible tables.
335
336This affects `yas/insert-snippet', `yas/visit-snippet-file'"
337 :type 'boolean
338 :group 'yasnippet)
339
340(defcustom yas/use-menu 'real-modes
341 "Display a YASnippet menu in the menu bar.
342
343When non-nil, submenus for each snippet table will be listed
344under the menu \"Yasnippet\".
345
346- If set to `real-modes' only submenus whose name more or less
347corresponds to a major mode are listed.
348
349- If set to `abbreviate', only the current major-mode
350menu and the modes set in `yas/mode-symbol' are listed.
351
352Any other non-nil value, every submenu is listed."
353 :type '(choice (const :tag "Full" t)
354 (const :tag "Real modes only" real-modes)
355 (const :tag "Abbreviate" abbreviate))
356 :group 'yasnippet)
357
358(defcustom yas/trigger-symbol " =>"
359 "The text that will be used in menu to represent the trigger."
360 :type 'string
361 :group 'yasnippet)
362
363(defcustom yas/wrap-around-region nil
364 "If non-nil, snippet expansion wraps around selected region.
365
366The wrapping occurs just before the snippet's exit marker. This
367can be overriden on a per-snippet basis."
368 :type 'boolean
369 :group 'yasnippet)
370
371(defcustom yas/good-grace t
372 "If non-nil, don't raise errors in inline elisp evaluation.
373
374An error string \"[yas] error\" is returned instead."
375 :type 'boolean
376 :group 'yasnippet)
377
378(defcustom yas/ignore-filenames-as-triggers nil
379 "If non-nil, don't derive tab triggers from filenames.
380
381This means a snippet without a \"# key:'\ directive wont have a
382tab trigger."
383 :type 'boolean
384 :group 'yasnippet)
385
386(defcustom yas/visit-from-menu nil
387 "If non-nil visit snippets's files from menu, instead of expanding them.
388
389This cafn only work when snippets are loaded from files."
390 :type 'boolean
391 :group 'yasnippet)
392
393(defface yas/field-highlight-face
394 '((((class color) (background light)) (:background "DarkSeaGreen1"))
395 (t (:background "DimGrey")))
396 "The face used to highlight the currently active field of a snippet"
397 :group 'yasnippet)
398
399(defface yas/field-debug-face
400 '()
401 "The face used for debugging some overlays normally hidden"
402 :group 'yasnippet)
403
404
405;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
406;; User can also customize the next defvars
407(defun yas/define-some-keys (keys keymap definition)
408 "Bind KEYS to DEFINITION in KEYMAP, read with `read-kbd-macro'."
409 (let ((keys (or (and (listp keys) keys)
410 (list keys))))
411 (dolist (key keys)
412 (define-key keymap (read-kbd-macro key) definition))))
413
414(defvar yas/keymap
415 (let ((map (make-sparse-keymap)))
416 (mapc #'(lambda (binding)
417 (yas/define-some-keys (car binding) map (cdr binding)))
418 `((,yas/next-field-key . yas/next-field-or-maybe-expand)
419 (,yas/prev-field-key . yas/prev-field)
420 ("C-g" . yas/abort-snippet)
421 (,yas/skip-and-clear-key . yas/skip-and-clear-or-delete-char)))
422 map)
423 "The keymap active while a snippet expansion is in progress.")
424
425(defvar yas/key-syntaxes (list "w" "w_" "w_." "^ ")
426 "A list of syntax of a key. This list is tried in the order
427to try to find a key. For example, if the list is '(\"w\" \"w_\").
428And in emacs-lisp-mode, where \"-\" has the syntax of \"_\":
429
430foo-bar
431
432will first try \"bar\", if not found, then \"foo-bar\" is tried.")
433
434(defvar yas/after-exit-snippet-hook
435 '()
436 "Hooks to run after a snippet exited.
437
438The hooks will be run in an environment where some variables bound to
439proper values:
440
441`yas/snippet-beg' : The beginning of the region of the snippet.
442
443`yas/snippet-end' : Similar to beg.
444
445Attention: These hooks are not run when exiting nested/stackd snippet expansion!")
446
447(defvar yas/before-expand-snippet-hook
448 '()
449 "Hooks to run just before expanding a snippet.")
450
451(defvar yas/buffer-local-condition
452 '(if (and (not (bobp))
453 (or (equal 'font-lock-comment-face
454 (get-char-property (1- (point))
455 'face))
456 (equal 'font-lock-string-face
457 (get-char-property (1- (point))
458 'face))))
459 '(require-snippet-condition . force-in-comment)
460 t)
461 "Snippet expanding condition.
462
463This variable is a lisp form:
464
465 * If it evaluates to nil, no snippets can be expanded.
466
467 * If it evaluates to the a cons (require-snippet-condition
468 . REQUIREMENT)
469
470 * Snippets bearing no \"# condition:\" directive are not
471 considered
472
473 * Snippets bearing conditions that evaluate to nil (or
474 produce an error) won't be onsidered.
475
476 * If the snippet has a condition that evaluates to non-nil
477 RESULT:
478
479 * If REQUIREMENT is t, the snippet is considered
480
481 * If REQUIREMENT is `eq' RESULT, the snippet is
482 considered
483
484 * Otherwise, the snippet is not considered.
485
486 * If it evaluates to the symbol 'always, all snippets are
487 considered for expansion, regardless of any conditions.
488
489 * If it evaluates to t or some other non-nil value
490
491 * Snippet bearing no conditions, or conditions that
492 evaluate to non-nil, are considered for expansion.
493
494 * Otherwise, the snippet is not considered.
495
496Here's an example preventing snippets from being expanded from
497inside comments, in `python-mode' only, with the exception of
498snippets returning the symbol 'force-in-comment in their
499conditions.
500
501 (add-hook 'python-mode-hook
502 '(lambda ()
503 (setq yas/buffer-local-condition
504 '(if (python-in-string/comment)
505 '(require-snippet-condition . force-in-comment)
506 t))))
507
508The default value is similar, it filters out potential snippet
509expansions inside comments and string literals, unless the
510snippet itself contains a condition that returns the symbol
511`force-in-comment'.")
512(make-variable-buffer-local 'yas/buffer-local-condition)
513
514
515;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
516;; Internal variables
517
518(defvar yas/version "0.6.1b")
519
520(defvar yas/menu-table (make-hash-table)
521 "A hash table of MAJOR-MODE symbols to menu keymaps.")
522
523(defvar yas/active-keybindings nil
524 "A list of cons (KEYMAP . KEY) setup from defining snippets.")
525
526(defvar yas/known-modes
527 '(ruby-mode rst-mode markdown-mode)
528 "A list of mode which is well known but not part of emacs.")
529
530(defvar yas/escaped-characters
531 '(?\\ ?` ?' ?$ ?} )
532 "List of characters which *might* need to be escaped.")
533
534(defconst yas/field-regexp
535 "${\\([0-9]+:\\)?\\([^}]*\\)}"
536 "A regexp to *almost* recognize a field.")
537
538(defconst yas/multi-dollar-lisp-expression-regexp
539 "$+[ \t\n]*\\(([^)]*)\\)"
540 "A regexp to *almost* recognize a \"$(...)\" expression.")
541
542(defconst yas/backquote-lisp-expression-regexp
543 "`\\([^`]*\\)`"
544 "A regexp to recognize a \"`lisp-expression`\" expression." )
545
546(defconst yas/transform-mirror-regexp
547 "${\\(?:\\([0-9]+\\):\\)?$\\([ \t\n]*([^}]*\\)"
548 "A regexp to *almost* recognize a mirror with a transform.")
549
550(defconst yas/simple-mirror-regexp
551 "$\\([0-9]+\\)"
552 "A regexp to recognize a simple mirror.")
553
554(defvar yas/snippet-id-seed 0
555 "Contains the next id for a snippet.")
556
557(defun yas/snippet-next-id ()
558 (let ((id yas/snippet-id-seed))
559 (incf yas/snippet-id-seed)
560 id))
561
562
563;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
564;; Minor mode stuff
565
566;; XXX: `last-buffer-undo-list' is somehow needed in Carbon Emacs for MacOSX
567(defvar last-buffer-undo-list nil)
568
569(defvar yas/minor-mode-menu nil
570 "Holds the YASnippet menu")
571
572(defun yas/init-minor-keymap ()
573 (let ((map (make-sparse-keymap)))
574 (easy-menu-define yas/minor-mode-menu
575 map
576 "Menu used when YAS/minor-mode is active."
577 '("YASnippet"
578 "----"
579 ["Expand trigger" yas/expand
580 :help "Possibly expand tab trigger before point"]
581 ["Insert at point..." yas/insert-snippet
582 :help "Prompt for an expandable snippet and expand it at point"]
583 ["New snippet..." yas/new-snippet
584 :help "Create a new snippet in an appropriate directory"]
585 ["Visit snippet file..." yas/visit-snippet-file
586 :help "Prompt for an expandable snippet and find its file"]
587 ["Find snippets..." yas/find-snippets
588 :help "Invoke `find-file' in the appropriate snippet directory"]
589 "----"
590 ("Snippet menu behaviour"
591 ["Visit snippets" (setq yas/visit-from-menu t)
592 :help "Visit snippets from the menu"
593 :active t :style radio :selected yas/visit-from-menu]
594 ["Expand snippets" (setq yas/visit-from-menu nil)
595 :help "Expand snippets from the menu"
596 :active t :style radio :selected (not yas/visit-from-menu)]
597 "----"
598 ["Show \"Real\" modes only" (setq yas/use-menu 'real-modes)
599 :help "Show snippet submenus for modes that appear to be real major modes"
600 :active t :style radio :selected (eq yas/use-menu 'real-modes)]
601 ["Show all modes" (setq yas/use-menu 't)
602 :help "Show one snippet submenu for each loaded table"
603 :active t :style radio :selected (eq yas/use-menu 't)]
604 ["Abbreviate according to current mode" (setq yas/use-menu 'abbreviate)
605 :help "Show only snippet submenus for the current active modes"
606 :active t :style radio :selected (eq yas/use-menu 'abbreviate)])
607 ("Indenting"
608 ["Auto" (setq yas/indent-line 'auto)
609 :help "Indent each line of the snippet with `indent-according-to-mode'"
610 :active t :style radio :selected (eq yas/indent-line 'auto)]
611 ["Fixed" (setq yas/indent-line 'fixed)
612 :help "Indent the snippet to the current column"
613 :active t :style radio :selected (eq yas/indent-line 'fixed)]
614 ["None" (setq yas/indent-line 'none)
615 :help "Don't apply any particular snippet indentation after expansion"
616 :active t :style radio :selected (not (member yas/indent-line '(fixed auto)))]
617 "----"
618 ["Also auto indent first line" (setq yas/also-auto-indent-first-line
619 (not yas/also-auto-indent-first-line))
620 :help "When auto-indenting also, auto indent the first line menu"
621 :active (eq yas/indent-line 'auto)
622 :style toggle :selected yas/also-auto-indent-first-line]
623 )
624 ("Prompting method"
625 ["System X-widget" (setq yas/prompt-functions
626 (cons 'yas/x-prompt
627 (remove 'yas/x-prompt
628 yas/prompt-functions)))
629 :help "Use your windowing system's (gtk, mac, windows, etc...) default menu"
630 :active t :style radio :selected (eq (car yas/prompt-functions)
631 'yas/x-prompt)]
632 ["Dropdown-list" (setq yas/prompt-functions
633 (cons 'yas/dropdown-prompt
634 (remove 'yas/dropdown-prompt
635 yas/prompt-functions)))
636 :help "Use a special dropdown list"
637 :active t :style radio :selected (eq (car yas/prompt-functions)
638 'yas/dropdown-prompt)]
639 ["Ido" (setq yas/prompt-functions
640 (cons 'yas/ido-prompt
641 (remove 'yas/ido-prompt
642 yas/prompt-functions)))
643 :help "Use an ido-style minibuffer prompt"
644 :active t :style radio :selected (eq (car yas/prompt-functions)
645 'yas/ido-prompt)]
646 ["Completing read" (setq yas/prompt-functions
647 (cons 'yas/completing-prompt
648 (remove 'yas/completing-prompt-prompt
649 yas/prompt-functions)))
650 :help "Use a normal minibuffer prompt"
651 :active t :style radio :selected (eq (car yas/prompt-functions)
652 'yas/completing-prompt-prompt)]
653 )
654 ("Misc"
655 ["Wrap region in exit marker"
656 (setq yas/wrap-around-region
657 (not yas/wrap-around-region))
658 :help "If non-nil automatically wrap the selected text in the $0 snippet exit"
659 :style toggle :selected yas/wrap-around-region]
660 ["Allow stacked expansions "
661 (setq yas/triggers-in-field
662 (not yas/triggers-in-field))
663 :help "If non-nil allow snippets to be triggered inside other snippet fields"
664 :style toggle :selected yas/triggers-in-field]
665 ["Revive snippets on undo "
666 (setq yas/snippet-revival
667 (not yas/snippet-revival))
668 :help "If non-nil allow snippets to become active again after undo"
669 :style toggle :selected yas/snippet-revival]
670 ["Good grace "
671 (setq yas/good-grace
672 (not yas/good-grace))
673 :help "If non-nil don't raise errors in bad embedded eslip in snippets"
674 :style toggle :selected yas/good-grace]
675 ["Ignore filenames as triggers"
676 (setq yas/ignore-filenames-as-triggers
677 (not yas/ignore-filenames-as-triggers))
678 :help "If non-nil don't derive tab triggers from filenames"
679 :style toggle :selected yas/ignore-filenames-as-triggers]
680 )
681 "----"
682 ["Load snippets..." yas/load-directory
683 :help "Load snippets from a specific directory"]
684 ["Reload everything" yas/reload-all
685 :help "Cleanup stuff, reload snippets, rebuild menus"]
686 ["About" yas/about
687 :help "Display some information about YASsnippet"]))
688 ;; Now for the stuff that has direct keybindings
689 ;;
690 (define-key map "\C-c&\C-s" 'yas/insert-snippet)
691 (define-key map "\C-c&\C-n" 'yas/new-snippet)
692 (define-key map "\C-c&\C-v" 'yas/visit-snippet-file)
693 (define-key map "\C-c&\C-f" 'yas/find-snippets)
694 map))
695
696(defvar yas/minor-mode-map (yas/init-minor-keymap)
697 "The keymap used when `yas/minor-mode' is active.")
698
699(defun yas/trigger-key-reload (&optional unbind-key)
700 "Rebind `yas/expand' to the new value of `yas/trigger-key'.
701
702With optional UNBIND-KEY, try to unbind that key from
703`yas/minor-mode-map'."
704 (when (and unbind-key
705 (stringp unbind-key)
706 (not (string= unbind-key "")))
707 (define-key yas/minor-mode-map (read-kbd-macro unbind-key) nil))
708 (when (and yas/trigger-key
709 (stringp yas/trigger-key)
710 (not (string= yas/trigger-key "")))
711 (define-key yas/minor-mode-map (read-kbd-macro yas/trigger-key) 'yas/expand)))
712
713;;;###autoload
714(define-minor-mode yas/minor-mode
715 "Toggle YASnippet mode.
716
717When YASnippet mode is enabled, the `tas/trigger-key' key expands
718snippets of code depending on the mode.
719
720With no argument, this command toggles the mode.
721positive prefix argument turns on the mode.
722Negative prefix argument turns off the mode.
723
724You can customize the key through `yas/trigger-key'.
725
726Key bindings:
727\\{yas/minor-mode-map}"
728 nil
729 ;; The indicator for the mode line.
730 " yas"
731 :group 'yasnippet
732 (when yas/minor-mode
733 (yas/trigger-key-reload)
734 ;; load all snippets definitions unless we still don't have a
735 ;; root-directory or some snippets have already been loaded.
736 (unless (or (null yas/root-directory)
737 (> (hash-table-count yas/snippet-tables) 0))
738 (yas/reload-all))))
739
740(defvar yas/dont-activate #'(lambda ()
741 (and yas/root-directory
742 (null (yas/get-snippet-tables))))
743 "If non-nil don't let `yas/minor-mode-on' active yas for this buffer.
744
745`yas/minor-mode-on' is usually called by `yas/global-mode' so
746this effectively lets you define exceptions to the \"global\"
747behaviour.")
748(make-variable-buffer-local 'yas/dont-activate)
749
750
751(defun yas/minor-mode-on ()
752 "Turn on YASnippet minor mode.
753
754Do this unless `yas/dont-activate' is t or the function
755`yas/get-snippet-tables' (which see), returns an empty list."
756 (interactive)
757 (unless (or (and (functionp yas/dont-activate)
758 (funcall yas/dont-activate))
759 (and (not (functionp yas/dont-activate))
760 yas/dont-activate))
761 (yas/minor-mode 1)))
762
763(defun yas/minor-mode-off ()
764 "Turn off YASnippet minor mode."
765 (interactive)
766 (yas/minor-mode -1))
767
768(define-globalized-minor-mode yas/global-mode yas/minor-mode yas/minor-mode-on
769 :group 'yasnippet
770 :require 'yasnippet)
771
772;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
773;; Major mode stuff
774;;
775(defvar yas/font-lock-keywords
776 (append '(("^#.*$" . font-lock-comment-face))
777 lisp-font-lock-keywords
778 lisp-font-lock-keywords-1
779 lisp-font-lock-keywords-2
780 '(("$\\([0-9]+\\)"
781 (0 font-lock-keyword-face)
782 (1 font-lock-string-face t))
783 ("${\\([0-9]+\\):?"
784 (0 font-lock-keyword-face)
785 (1 font-lock-warning-face t))
786 ("${" font-lock-keyword-face)
787 ("$[0-9]+?" font-lock-preprocessor-face)
788 ("\\(\\$(\\)" 1 font-lock-preprocessor-face)
789 ("}"
790 (0 font-lock-keyword-face)))))
791
792(defun yas/init-major-keymap ()
793 (let ((map (make-sparse-keymap)))
794 (easy-menu-define nil
795 map
796 "Menu used when snippet-mode is active."
797 (cons "Snippet"
798 (mapcar #'(lambda (ent)
799 (when (third ent)
800 (define-key map (third ent) (second ent)))
801 (vector (first ent) (second ent) t))
802 (list
803 (list "Load this snippet" 'yas/load-snippet-buffer "\C-c\C-c")
804 (list "Try out this snippet" 'yas/tryout-snippet "\C-c\C-t")))))
805 map))
806
807(defvar snippet-mode-map
808 (yas/init-major-keymap)
809 "The keymap used when `snippet-mode' is active")
810
811
812(define-derived-mode snippet-mode text-mode "Snippet"
813 "A mode for editing yasnippets"
814 (set-syntax-table (standard-syntax-table))
815 (setq font-lock-defaults '(yas/font-lock-keywords))
816 (set (make-local-variable 'require-final-newline) nil)
817 (use-local-map snippet-mode-map))
818
819;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
820;; Internal structs for template management
821
822(defstruct (yas/template (:constructor yas/make-template
823 (content name condition expand-env file keybinding)))
824 "A template for a snippet."
825 content
826 name
827 condition
828 expand-env
829 file
830 keybinding)
831
832(defvar yas/snippet-tables (make-hash-table)
833 "A hash table of MAJOR-MODE symbols to `yas/snippet-table' objects.")
834
835(defstruct (yas/snippet-table (:constructor yas/make-snippet-table (name)))
836 "A table to store snippets for a particular mode.
837
838Has the following fields:
839
840`yas/snippet-table-name'
841
842 A symbol normally corresponding to a major mode, but can also be
843 a pseudo major-mode to be referenced in `yas/mode-symbol', for
844 example.
845
846`yas/snippet-table-hash'
847
848 A hash table the key is a string (the snippet key) and the
849 value is yet another hash of (NAME TEMPLATE), where NAME is the
850 snippet name and TEMPLATE is a `yas/template' object name.
851
852`yas/snippet-table-parents'
853
854 A list of tables considered parents of this table: i.e. when
855 searching for expansions they are searched as well."
856 name
857 (hash (make-hash-table :test 'equal))
858 (parents nil))
859
860(defvar yas/better-guess-for-replacements nil
861 "If non-nil `yas/store' better guess snippet replacements.")
862
863(defun yas/store (table name key template)
864 "Store a snippet template in the TABLE."
865
866 ;; This is dones by searching twice:
867 ;;
868 ;; * Try to get the existing namehash from TABLE using key.
869 ;;
870 ;; * Try to get the existing namehash from by searching the *whole*
871 ;; snippet table for NAME. This is becuase they user might have
872 ;; changed the key and that can no longer be used to locate the
873 ;; previous `yas/template-structure'.
874 ;;
875 ;; * If that returns nothing, oh well...
876 ;;
877 (dolist (existing-namehash (remove nil (list (gethash key (yas/snippet-table-hash table))
878 (when yas/better-guess-for-replacements
879 (let (a)
880 (maphash #'(lambda (key namehash)
881 (when (gethash name namehash)
882 (setq a namehash)))
883 (yas/snippet-table-hash table))
884 a)))))
885 (let ((existing-template (gethash name existing-namehash)))
886 (when existing-template
887 ;; Remove the existing keybinding
888 (when (yas/template-keybinding existing-template)
889 (define-key
890 (symbol-value (first (yas/template-keybinding existing-template)))
891 (second (yas/template-keybinding existing-template))
892 nil)
893 (setq yas/active-keybindings
894 (delete (yas/template-keybinding existing-template)
895 yas/active-keybindings)))
896 ;; Remove the (name . template) mapping from existing-namehash.
897 (remhash name existing-namehash))))
898 ;; Now store the new template independent of the previous steps.
899 ;;
900 (puthash name
901 template
902 (or (gethash key
903 (yas/snippet-table-hash table))
904 (puthash key
905 (make-hash-table :test 'equal)
906 (yas/snippet-table-hash table)))))
907
908(defun yas/fetch (table key)
909 "Fetch a snippet binding to KEY from TABLE."
910 (let* ((keyhash (yas/snippet-table-hash table))
911 (namehash (and keyhash (gethash key keyhash))))
912 (when namehash
913 (yas/filter-templates-by-condition
914 (let (alist)
915 (maphash #'(lambda (k v)
916 (push (cons k v) alist))
917 namehash)
918 alist)))))
919
920
921;; Filtering/condition logic
922
923(defun yas/eval-condition (condition)
924 (condition-case err
925 (save-excursion
926 (save-restriction
927 (save-match-data
928 (eval condition))))
929 (error (progn
930 (message (format "[yas] error in condition evaluation: %s"
931 (error-message-string err)))
932 nil))))
933
934
935(defun yas/filter-templates-by-condition (templates)
936 "Filter the templates using the applicable condition.
937
938TEMPLATES is a list of cons (NAME . TEMPLATE) where NAME is a
939string and TEMPLATE is a `yas/template' structure.
940
941This function implements the rules described in
942`yas/buffer-local-condition'. See that variables documentation."
943 (let ((requirement (yas/require-template-specific-condition-p)))
944 (if (eq requirement 'always)
945 templates
946 (remove-if-not #'(lambda (pair)
947 (yas/template-can-expand-p (yas/template-condition (cdr pair)) requirement))
948 templates))))
949
950(defun yas/require-template-specific-condition-p ()
951 "Decides if this buffer requests/requires snippet-specific
952conditions to filter out potential expansions."
953 (if (eq 'always yas/buffer-local-condition)
954 'always
955 (let ((local-condition (or (and (consp yas/buffer-local-condition)
956 (yas/eval-condition yas/buffer-local-condition))
957 yas/buffer-local-condition)))
958 (when local-condition
959 (if (eq local-condition t)
960 t
961 (and (consp local-condition)
962 (eq 'require-snippet-condition (car local-condition))
963 (symbolp (cdr local-condition))
964 (cdr local-condition)))))))
965
966(defun yas/template-can-expand-p (condition &optional requirement)
967 "Evaluates CONDITION and REQUIREMENT and returns a boolean"
968 (let* ((requirement (or requirement
969 (yas/require-template-specific-condition-p)))
970 (result (or (null condition)
971 (yas/eval-condition
972 (condition-case err
973 (read condition)
974 (error (progn
975 (message (format "[yas] error reading condition: %s"
976 (error-message-string err))))
977 nil))))))
978 (cond ((eq requirement t)
979 result)
980 (t
981 (eq requirement result)))))
982
983(defun yas/snippet-table-get-all-parents (table)
984 (let ((parents (yas/snippet-table-parents table)))
985 (when parents
986 (append (copy-list parents)
987 (mapcan #'yas/snippet-table-get-all-parents parents)))))
988
989(defun yas/snippet-table-templates (table)
990 (when table
991 (let ((acc (list)))
992 (maphash #'(lambda (key namehash)
993 (maphash #'(lambda (name template)
994 (push (cons name template) acc))
995 namehash))
996 (yas/snippet-table-hash table))
997 (yas/filter-templates-by-condition acc))))
998
999(defun yas/current-key ()
1000 "Get the key under current position. A key is used to find
1001the template of a snippet in the current snippet-table."
1002 (let ((start (point))
1003 (end (point))
1004 (syntaxes yas/key-syntaxes)
1005 syntax
1006 done
1007 templates)
1008 (while (and (not done) syntaxes)
1009 (setq syntax (car syntaxes))
1010 (setq syntaxes (cdr syntaxes))
1011 (save-excursion
1012 (skip-syntax-backward syntax)
1013 (setq start (point)))
1014 (setq templates
1015 (mapcan #'(lambda (table)
1016 (yas/fetch table (buffer-substring-no-properties start end)))
1017 (yas/get-snippet-tables)))
1018 (if templates
1019 (setq done t)
1020 (setq start end)))
1021 (list templates
1022 start
1023 end)))
1024
1025
1026(defun yas/snippet-table-all-keys (table)
1027 (when table
1028 (let ((acc))
1029 (maphash #'(lambda (key templates)
1030 (when (yas/filter-templates-by-condition templates)
1031 (push key acc)))
1032 (yas/snippet-table-hash table))
1033 acc)))
1034
1035
1036;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1037;; Internal functions
1038
1039(defun yas/real-mode? (mode)
1040 "Try to find out if MODE is a real mode. The MODE bound to
1041a function (like `c-mode') is considered real mode. Other well
1042known mode like `ruby-mode' which is not part of Emacs might
1043not bound to a function until it is loaded. So yasnippet keeps
1044a list of modes like this to help the judgement."
1045 (or (fboundp mode)
1046 (find mode yas/known-modes)))
1047
1048(defun yas/read-and-eval-string (string)
1049 ;; TODO: This is a possible optimization point, the expression could
1050 ;; be stored in cons format instead of string,
1051 "Evaluate STRING and convert the result to string."
1052 (let ((retval (catch 'yas/exception
1053 (condition-case err
1054 (save-excursion
1055 (save-restriction
1056 (save-match-data
1057 (widen)
1058 (let ((result (eval (read string))))
1059 (when result
1060 (format "%s" result))))))
1061 (error (if yas/good-grace
1062 "[yas] elisp error!"
1063 (error (format "[yas] elisp error: %s"
1064 (error-message-string err)))))))))
1065 (when (and (consp retval)
1066 (eq 'yas/exception (car retval)))
1067 (error (cdr retval)))
1068 retval))
1069
1070(defvar yas/mode-symbol nil
1071 "If non-nil, lookup snippets using this instead of `major-mode'.")
1072(make-variable-buffer-local 'yas/mode-symbol)
1073
1074(defun yas/snippet-table-get-create (mode)
1075 "Get the snippet table corresponding to MODE.
1076
1077Optional DIRECTORY gets recorded as the default directory to
1078search for snippet files if the retrieved/created table didn't
1079already have such a property."
1080 (let ((table (gethash mode
1081 yas/snippet-tables)))
1082 (unless table
1083 (setq table (yas/make-snippet-table (symbol-name mode)))
1084 (puthash mode table yas/snippet-tables))
1085 table))
1086
1087(defun yas/get-snippet-tables (&optional mode-symbol dont-search-parents)
1088 "Get snippet tables for current buffer.
1089
1090Return a list of 'yas/snippet-table' objects indexed by mode.
1091
1092The modes are tried in this order: optional MODE-SYMBOL, then
1093`yas/mode-symbol', then `major-mode' then, unless
1094DONT-SEARCH-PARENTS is non-nil, the guessed parent mode of either
1095MODE-SYMBOL or `major-mode'.
1096
1097Guessing is done by looking up the MODE-SYMBOL's
1098`derived-mode-parent' property, see also `derived-mode-p'."
1099 (let ((mode-tables
1100 (mapcar #'(lambda (mode)
1101 (gethash mode yas/snippet-tables))
1102 (append (list mode-symbol)
1103 (if (listp yas/mode-symbol)
1104 yas/mode-symbol
1105 (list yas/mode-symbol))
1106 (list major-mode
1107 (and (not dont-search-parents)
1108 (get (or mode-symbol major-mode)
1109 'derived-mode-parent))))))
1110 (all-tables))
1111 (dolist (table (remove nil mode-tables))
1112 (push table all-tables)
1113 (nconc all-tables (yas/snippet-table-get-all-parents table)))
1114 (remove-duplicates all-tables)))
1115
1116(defun yas/menu-keymap-get-create (mode)
1117 "Get the menu keymap correspondong to MODE."
1118 (or (gethash mode yas/menu-table)
1119 (puthash mode (make-sparse-keymap) yas/menu-table)))
1120
1121;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1122;;; Template-related and snippet loading functions
1123
1124(defun yas/parse-template (&optional file)
1125 "Parse the template in the current buffer.
1126
1127Optional FILE is the absolute file name of the file being
1128parsed.
1129
1130Return a snippet-definition, i.e. a list
1131
1132 (KEY TEMPLATE NAME CONDITION GROUP VARS FILE KEYBINDING)
1133
1134If the buffer contains a line of \"# --\" then the contents
1135above this line are ignored. Variables can be set above this
1136line through the syntax:
1137
1138#name : value
1139
1140Here's a list of currently recognized variables:
1141
1142 * name
1143 * contributor
1144 * condition
1145 * key
1146 * group
1147 * expand-env
1148
1149#name: #include \"...\"
1150# --
1151#include \"$1\""
1152 ;;
1153 ;;
1154 (goto-char (point-min))
1155 (let* ((name (and file
1156 (file-name-nondirectory file)))
1157 (key (unless yas/ignore-filenames-as-triggers
1158 (and name
1159 (file-name-sans-extension name))))
1160 template
1161 bound
1162 condition
1163 (group (and file
1164 (yas/calculate-group file)))
1165 expand-env
1166 binding)
1167 (if (re-search-forward "^# --\n" nil t)
1168 (progn (setq template
1169 (buffer-substring-no-properties (point)
1170 (point-max)))
1171 (setq bound (point))
1172 (goto-char (point-min))
1173 (while (re-search-forward "^# *\\([^ ]+?\\) *: *\\(.*\\)$" bound t)
1174 (when (string= "name" (match-string-no-properties 1))
1175 (setq name (match-string-no-properties 2)))
1176 (when (string= "condition" (match-string-no-properties 1))
1177 (setq condition (match-string-no-properties 2)))
1178 (when (string= "group" (match-string-no-properties 1))
1179 (setq group (match-string-no-properties 2)))
1180 (when (string= "expand-env" (match-string-no-properties 1))
1181 (setq expand-env (match-string-no-properties 2)))
1182 (when (string= "key" (match-string-no-properties 1))
1183 (setq key (match-string-no-properties 2)))
1184 (when (string= "binding" (match-string-no-properties 1))
1185 (setq binding (match-string-no-properties 2)))))
1186 (setq template
1187 (buffer-substring-no-properties (point-min) (point-max))))
1188 (list key template name condition group expand-env file binding)))
1189
1190(defun yas/calculate-group (file)
1191 "Calculate the group for snippet file path FILE."
1192 (let* ((dominating-dir (locate-dominating-file file
1193 ".yas-make-groups"))
1194 (extra-path (and dominating-dir
1195 (replace-regexp-in-string (concat "^"
1196 (expand-file-name dominating-dir))
1197 ""
1198 (expand-file-name file))))
1199 (extra-dir (and extra-path
1200 (file-name-directory extra-path)))
1201 (group (and extra-dir
1202 (replace-regexp-in-string "/"
1203 "."
1204 (directory-file-name extra-dir)))))
1205 group))
1206
1207;; (defun yas/glob-files (directory &optional recurse-p append)
1208;; "Returns files under DIRECTORY ignoring dirs and hidden files.
1209
1210;; If RECURSE in non-nil, do that recursively."
1211;; (let (ret
1212;; (default-directory directory))
1213;; (dolist (entry (directory-files "."))
1214;; (cond ((or (string-match "^\\."
1215;; (file-name-nondirectory entry))
1216;; (string-match "~$"
1217;; (file-name-nondirectory entry)))
1218;; nil)
1219;; ((and recurse-p
1220;; (file-directory-p entry))
1221;; (setq ret (nconc ret
1222;; (yas/glob-files (expand-file-name entry)
1223;; recurse-p
1224;; (if append
1225;; (concat append "/" entry)
1226;; entry)))))
1227;; ((file-directory-p entry)
1228;; nil)
1229;; (t
1230;; (push (if append
1231;; (concat append "/" entry)
1232;; entry) ret))))
1233;; ret))
1234
1235(defun yas/subdirs (directory &optional file?)
1236 "Return subdirs or files of DIRECTORY according to FILE?."
1237 (remove-if (lambda (file)
1238 (or (string-match "^\\."
1239 (file-name-nondirectory file))
1240 (string-match "~$"
1241 (file-name-nondirectory file))
1242 (if file?
1243 (file-directory-p file)
1244 (not (file-directory-p file)))))
1245 (directory-files directory t)))
1246
1247(defun yas/make-menu-binding (template)
1248 `(lambda () (interactive) (yas/expand-or-visit-from-menu ,template)))
1249
1250(defun yas/expand-or-visit-from-menu (template)
1251 (if yas/visit-from-menu
1252 (yas/visit-snippet-file-1 template)
1253 (let ((where (if mark-active
1254 (cons (region-beginning) (region-end))
1255 (cons (point) (point)))))
1256 (yas/expand-snippet (yas/template-content template)
1257 (car where)
1258 (cdr where)))))
1259
1260;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1261;; Popping up for keys and templates
1262;;
1263(defun yas/prompt-for-template (templates &optional prompt)
1264 "Interactively choose a template from the list TEMPLATES.
1265
1266TEMPLATES is a list of `yas/template'."
1267 (when templates
1268 (some #'(lambda (fn)
1269 (funcall fn (or prompt "Choose a snippet: ")
1270 templates
1271 #'yas/template-name))
1272 yas/prompt-functions)))
1273
1274(defun yas/prompt-for-keys (keys &optional prompt)
1275 "Interactively choose a template key from the list KEYS."
1276 (when keys
1277 (some #'(lambda (fn)
1278 (funcall fn (or prompt "Choose a snippet key: ") keys))
1279 yas/prompt-functions)))
1280
1281(defun yas/prompt-for-table (tables &optional prompt)
1282 (when tables
1283 (some #'(lambda (fn)
1284 (funcall fn (or prompt "Choose a snippet table: ")
1285 tables
1286 #'yas/snippet-table-name))
1287 yas/prompt-functions)))
1288
1289(defun yas/x-prompt (prompt choices &optional display-fn)
1290 (when (and window-system choices)
1291 (let ((keymap (cons 'keymap
1292 (cons
1293 prompt
1294 (mapcar (lambda (choice)
1295 (list choice
1296 'menu-item
1297 (if display-fn
1298 (funcall display-fn choice)
1299 choice)
1300 t))
1301 choices)))))
1302 (when (cdr keymap)
1303 (car (x-popup-menu (if (fboundp 'posn-at-point)
1304 (let ((x-y (posn-x-y (posn-at-point (point)))))
1305 (list (list (+ (car x-y) 10)
1306 (+ (cdr x-y) 20))
1307 (selected-window)))
1308 t)
1309 keymap))))))
1310
1311(defun yas/ido-prompt (prompt choices &optional display-fn)
1312 (when (and (featurep 'ido)
1313 ido-mode)
1314 (let* ((formatted-choices (or (and display-fn
1315 (mapcar display-fn choices))
1316 choices))
1317 (chosen (and formatted-choices
1318 (ido-completing-read prompt
1319 formatted-choices
1320 nil
1321 'require-match
1322 nil
1323 nil))))
1324 (when chosen
1325 (nth (position chosen formatted-choices :test #'string=) choices)))))
1326
1327(eval-when-compile (require 'dropdown-list nil t))
1328(defun yas/dropdown-prompt (prompt choices &optional display-fn)
1329 (when (featurep 'dropdown-list)
1330 (let* ((formatted-choices (or (and display-fn
1331 (mapcar display-fn choices))
1332 choices))
1333 (chosen (and formatted-choices
1334 (nth (dropdown-list formatted-choices)
1335 choices))))
1336 chosen)))
1337
1338(defun yas/completing-prompt (prompt choices &optional display-fn)
1339 (let* ((formatted-choices (or (and display-fn
1340 (mapcar display-fn choices))
1341 choices))
1342 (chosen (and formatted-choices
1343 (completing-read prompt
1344 formatted-choices
1345 nil
1346 'require-match
1347 nil
1348 nil))))
1349 (when chosen
1350 (nth (position chosen formatted-choices :test #'string=) choices))))
1351
1352(defun yas/no-prompt (prompt choices &optional display-fn)
1353 (first choices))
1354
1355;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1356;; Loading snippets from files
1357;;
1358(defun yas/load-directory-1 (directory &optional parents no-hierarchy-parents making-groups-sym)
1359 "Recursively load snippet templates from DIRECTORY."
1360 ;; TODO: Rewrite this horrible, horrible monster I created
1361 (unless (file-exists-p (concat directory "/" ".yas-skip"))
1362 (let* ((major-mode-and-parents (unless making-groups-sym
1363 (yas/compute-major-mode-and-parents (concat directory "/dummy")
1364 nil
1365 no-hierarchy-parents)))
1366 (yas/ignore-filenames-as-triggers (or yas/ignore-filenames-as-triggers
1367 (file-exists-p (concat directory "/" ".yas-ignore-filenames-as-triggers"))))
1368 (mode-sym (and major-mode-and-parents
1369 (car major-mode-and-parents)))
1370 (parents (if making-groups-sym
1371 parents
1372 (rest major-mode-and-parents)))
1373 (snippet-defs nil)
1374 (make-groups-p (or making-groups-sym
1375 (file-exists-p (concat directory "/" ".yas-make-groups")))))
1376 (with-temp-buffer
1377 (dolist (file (yas/subdirs directory 'no-subdirs-just-files))
1378 (when (file-readable-p file)
1379 (insert-file-contents file nil nil nil t)
1380 (push (yas/parse-template file)
1381 snippet-defs))))
1382 (yas/define-snippets (or mode-sym
1383 making-groups-sym)
1384 snippet-defs
1385 parents)
1386 (dolist (subdir (yas/subdirs directory))
1387 (if make-groups-p
1388 (yas/load-directory-1 subdir parents 't (or mode-sym
1389 making-groups-sym))
1390 (yas/load-directory-1 subdir (list mode-sym)))))))
1391
1392(defun yas/load-directory (directory)
1393 "Load snippet definition from a directory hierarchy.
1394
1395Below the top-level directory, each directory is a mode
1396name. And under each subdirectory, each file is a definition
1397of a snippet. The file name is the trigger key and the
1398content of the file is the template."
1399 (interactive "DSelect the root directory: ")
1400 (unless (file-directory-p directory)
1401 (error "Error %s not a directory" directory))
1402 (unless yas/root-directory
1403 (setq yas/root-directory directory))
1404 (dolist (dir (yas/subdirs directory))
1405 (yas/load-directory-1 dir nil 'no-hierarchy-parents))
1406 (when (interactive-p)
1407 (message "done.")))
1408
1409(defun yas/kill-snippet-keybindings ()
1410 "Remove the all active snippet keybindings."
1411 (interactive)
1412 (dolist (keybinding yas/active-keybindings)
1413 (define-key (symbol-value (first keybinding)) (second keybinding) nil))
1414 (setq yas/active-keybindings nil))
1415
1416(defun yas/reload-all (&optional reset-root-directory)
1417 "Reload all snippets and rebuild the YASnippet menu. "
1418 (interactive "P")
1419 ;; Turn off global modes and minor modes, save their state though
1420 ;;
1421 (let ((restore-global-mode (prog1 yas/global-mode
1422 (yas/global-mode -1)))
1423 (restore-minor-mode (prog1 yas/minor-mode
1424 (yas/minor-mode -1))))
1425 ;; Empty all snippet tables and all menu tables
1426 ;;
1427 (setq yas/snippet-tables (make-hash-table))
1428 (setq yas/menu-table (make-hash-table))
1429
1430 ;; Init the `yas/minor-mode-map', taking care not to break the
1431 ;; menu....
1432 ;;
1433 (setf (cdr yas/minor-mode-map)
1434 (cdr (yas/init-minor-keymap)))
1435
1436 ;; Now, clean up the other keymaps we might have cluttered up.
1437 (yas/kill-snippet-keybindings)
1438
1439 (when reset-root-directory
1440 (setq yas/root-directory nil))
1441
1442 ;; Reload the directories listed in `yas/root-directory' or prompt
1443 ;; the user to select one.
1444 ;;
1445 (if yas/root-directory
1446 (if (listp yas/root-directory)
1447 (dolist (directory yas/root-directory)
1448 (yas/load-directory directory))
1449 (yas/load-directory yas/root-directory))
1450 (call-interactively 'yas/load-directory))
1451
1452 ;; Restore the mode configuration
1453 ;;
1454 (when restore-minor-mode
1455 (yas/minor-mode 1))
1456 (when restore-global-mode
1457 (yas/global-mode 1))
1458
1459 (message "[yas] Reloading everything... Done.")))
1460
1461(defun yas/quote-string (string)
1462 "Escape and quote STRING.
1463foo\"bar\\! -> \"foo\\\"bar\\\\!\""
1464 (concat "\""
1465 (replace-regexp-in-string "[\\\"]"
1466 "\\\\\\&"
1467 string
1468 t)
1469 "\""))
1470;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1471;;; Yasnippet Bundle
1472
1473(defun yas/initialize ()
1474 "For backward compatibility, enable `yas/minor-mode' globally"
1475 (yas/global-mode 1))
1476
1477(defun yas/compile-bundle
1478 (&optional yasnippet yasnippet-bundle snippet-roots code dropdown)
1479 "Compile snippets in SNIPPET-ROOTS to a single bundle file.
1480
1481YASNIPPET is the yasnippet.el file path.
1482
1483YASNIPPET-BUNDLE is the output file of the compile result.
1484
1485SNIPPET-ROOTS is a list of root directories that contains the
1486snippets definition.
1487
1488CODE is the code to be placed at the end of the generated file
1489and that can initialize the YASnippet bundle.
1490
1491Last optional argument DROPDOWN is the filename of the
1492dropdown-list.el library.
1493
1494Here's the default value for all the parameters:
1495
1496 (yas/compile-bundle \"yasnippet.el\"
1497 \"yasnippet-bundle.el\"
1498 \"snippets\")
1499 \"(yas/initialize-bundle)
1500 ### autoload
1501 (require 'yasnippet-bundle)`\"
1502 \"dropdown-list.el\")
1503"
1504 (interactive "ffind the yasnippet.el file: \nFTarget bundle file: \nDSnippet directory to bundle: \nMExtra code? \nfdropdown-library: ")
1505
1506 (let* ((yasnippet (or yasnippet
1507 "yasnippet.el"))
1508 (yasnippet-bundle (or yasnippet-bundle
1509 "./yasnippet-bundle.el"))
1510 (snippet-roots (or snippet-roots
1511 "snippets"))
1512 (dropdown (or dropdown
1513 "dropdown-list.el"))
1514 (code (or (and code
1515 (condition-case err (read code) (error nil))
1516 code)
1517 (concat "(yas/initialize-bundle)"
1518 "\n;;;###autoload" ; break through so that won't
1519 "(require 'yasnippet-bundle)")))
1520 (dirs (or (and (listp snippet-roots) snippet-roots)
1521 (list snippet-roots)))
1522 (bundle-buffer nil))
1523 (with-temp-file yasnippet-bundle
1524 (insert ";;; yasnippet-bundle.el --- "
1525 "Yet another snippet extension (Auto compiled bundle)\n")
1526 (insert-file-contents yasnippet)
1527 (goto-char (point-max))
1528 (insert "\n")
1529 (when dropdown
1530 (insert-file-contents dropdown))
1531 (goto-char (point-max))
1532 (insert ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n")
1533 (insert ";;;; Auto-generated code ;;;;\n")
1534 (insert ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n")
1535 (insert "(defun yas/initialize-bundle ()\n"
1536 " \"Initialize YASnippet and load snippets in the bundle.\"")
1537 (flet ((yas/define-snippets
1538 (mode snippets &optional parent-or-parents)
1539 (insert ";;; snippets for " (symbol-name mode) "\n")
1540 (let ((literal-snippets (list)))
1541 (dolist (snippet snippets)
1542 (let ((key (first snippet))
1543 (template-content (second snippet))
1544 (name (third snippet))
1545 (condition (fourth snippet))
1546 (group (fifth snippet))
1547 (expand-env (sixth snippet))
1548 ;; Omit the file on purpose
1549 (file nil) ;; (seventh snippet))
1550 (binding (eighth snippet)))
1551 (push `(,key
1552 ,template-content
1553 ,name
1554 ,condition
1555 ,group
1556 ,expand-env
1557 ,file
1558 ,binding)
1559 literal-snippets)))
1560 (insert (pp-to-string `(yas/define-snippets ',mode ',literal-snippets ',parent-or-parents)))
1561 (insert "\n\n"))))
1562 (dolist (dir dirs)
1563 (dolist (subdir (yas/subdirs dir))
1564 (yas/load-directory-1 subdir nil 'no-hierarchy-parents))))
1565
1566 (insert (pp-to-string `(yas/global-mode 1)))
1567 (insert ")\n\n" code "\n")
1568
1569 ;; bundle-specific provide and value for yas/dont-activate
1570 (let ((bundle-feature-name (file-name-nondirectory
1571 (file-name-sans-extension
1572 yasnippet-bundle))))
1573 (insert (pp-to-string `(set-default 'yas/dont-activate
1574 #'(lambda ()
1575 (and (or yas/root-directory
1576 (featurep ',(make-symbol bundle-feature-name)))
1577 (null (yas/get-snippet-tables)))))))
1578 (insert (pp-to-string `(provide ',(make-symbol bundle-feature-name)))))
1579
1580 (insert ";;; "
1581 (file-name-nondirectory yasnippet-bundle)
1582 " ends here\n"))))
1583
1584(defun yas/compile-textmate-bundle ()
1585 (interactive)
1586 (yas/compile-bundle "yasnippet.el"
1587 "./yasnippet-textmate-bundle.el"
1588 "extras/imported/"
1589 (concat "(yas/initialize-bundle)"
1590 "\n;;;###autoload" ; break through so that won't
1591 "(require 'yasnippet-textmate-bundle)")
1592 "dropdown-list.el"))
1593
1594;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1595;;; Some user level functions
1596;;;
1597
1598(defun yas/about ()
1599 (interactive)
1600 (message (concat "yasnippet (version "
1601 yas/version
1602 ") -- pluskid <pluskid@gmail.com>/joaotavora <joaotavora@gmail.com>")))
1603
1604(defun yas/define-snippets (mode snippets &optional parent-mode)
1605 "Define SNIPPETS for MODE.
1606
1607SNIPPETS is a list of snippet definitions, each taking the
1608following form:
1609
1610 (KEY TEMPLATE NAME CONDITION GROUP EXPAND-ENV FILE KEYBINDING)
1611
1612Within these, only TEMPLATE is actually mandatory.
1613
1614All the elelements are strings, including CONDITION, EXPAND-ENV
1615and KEYBINDING which will be `read' and eventually `eval'-ed.
1616
1617FILE is probably of very little use if you're programatically
1618defining snippets.
1619
1620You can use `yas/parse-template' to return such lists based on
1621the current buffers contents.
1622
1623Optional PARENT-MODE can be used to specify the parent tables of
1624MODE. It can be a mode symbol of a list of mode symbols. It does
1625not need to be a real mode."
1626 (let ((snippet-table (yas/snippet-table-get-create mode))
1627 (parent-tables (mapcar #'yas/snippet-table-get-create
1628 (if (listp parent-mode)
1629 parent-mode
1630 (list parent-mode))))
1631 (keymap (if yas/use-menu
1632 (yas/menu-keymap-get-create mode)
1633 nil)))
1634 ;; Setup the menu
1635 ;;
1636 (when parent-tables
1637 (setf (yas/snippet-table-parents snippet-table)
1638 parent-tables)
1639 (when yas/use-menu
1640 (let ((parent-menu-syms-and-names
1641 (if (listp parent-mode)
1642 (mapcar #'(lambda (sym)
1643 (cons sym (concat "parent mode - " (symbol-name sym))))
1644 parent-mode)
1645 '((parent-mode . "parent mode")))))
1646 (mapc #'(lambda (sym-and-name)
1647 (define-key keymap
1648 (vector (intern (replace-regexp-in-string " " "_" (cdr sym-and-name))))
1649 (list 'menu-item (cdr sym-and-name)
1650 (yas/menu-keymap-get-create (car sym-and-name)))))
1651 (reverse parent-menu-syms-and-names)))))
1652 (when yas/use-menu
1653 (define-key yas/minor-mode-menu (vector mode)
1654 `(menu-item ,(symbol-name mode) ,keymap
1655 :visible (yas/show-menu-p ',mode))))
1656 ;; Iterate the recently parsed snippets definition
1657 ;;
1658 (dolist (snippet snippets)
1659 (let* ((file (seventh snippet))
1660 (key (or (car snippet)
1661 (unless yas/ignore-filenames-as-triggers
1662 (and file
1663 (file-name-sans-extension (file-name-nondirectory file))))))
1664 (name (or (third snippet)
1665 (and file
1666 (file-name-directory file))))
1667 (condition (fourth snippet))
1668 (group (fifth snippet))
1669 (keybinding (eighth snippet))
1670 (template nil))
1671 ;; Read the snippet's "binding :" expression
1672 ;;
1673 (condition-case err
1674 (when keybinding
1675 (setq keybinding (read (eighth snippet)))
1676 (let* ((this-mode-map-symbol (intern (concat (symbol-name mode) "-map")))
1677 (keys (or (and (consp keybinding)
1678 (read-kbd-macro (cdr keybinding)))
1679 (read-kbd-macro keybinding)))
1680 (keymap-symbol (or (and (consp keybinding)
1681 (car keybinding))
1682 this-mode-map-symbol)))
1683 (if (and (boundp keymap-symbol)
1684 (keymapp (symbol-value keymap-symbol)))
1685 (setq keybinding (list keymap-symbol
1686 keys
1687 name))
1688 (error (format "keymap \"%s\" does not (yet?) exist" keymap-symbol)))))
1689 (error
1690 (message "[yas] warning: keybinding \"%s\" invalid for snippet \"%s\" since %s."
1691 keybinding name (error-message-string err))
1692 (setf keybinding nil)))
1693
1694 ;; Create the `yas/template' object and store in the
1695 ;; appropriate snippet table. This only done if we have found
1696 ;; a key and a name for the snippet, because that is what
1697 ;; indexes the snippet tables
1698 ;;
1699 (setq template (yas/make-template (second snippet)
1700 (or name key)
1701 condition
1702 (sixth snippet)
1703 (seventh snippet)
1704 keybinding))
1705 (when (and key
1706 name)
1707 (yas/store snippet-table
1708 name
1709 key
1710 template))
1711 ;; If we have a keybinding, register it if it does not
1712 ;; conflict!
1713 ;;
1714 (when keybinding
1715 (let ((lookup (lookup-key (symbol-value (first keybinding)) (second keybinding))))
1716 (if (and lookup
1717 (not (numberp lookup)))
1718 (message "[yas] warning: won't overwrite keybinding \"%s\" for snippet \"%s\" in `%s'"
1719 (key-description (second keybinding)) name (first keybinding))
1720 (define-key
1721 (symbol-value (first keybinding))
1722 (second keybinding)
1723 `(lambda (&optional yas/prefix)
1724 (interactive "P")
1725 (when (yas/template-can-expand-p ,(yas/template-condition template))
1726 (yas/expand-snippet ,(yas/template-content template)
1727 nil
1728 nil
1729 ,(yas/template-expand-env template)))))
1730 (add-to-list 'yas/active-keybindings keybinding))))
1731
1732 ;; Setup the menu groups, reorganizing from group to group if
1733 ;; necessary
1734 ;;
1735 (when yas/use-menu
1736 (let ((group-keymap keymap))
1737 ;; Delete this entry from another group if already exists
1738 ;; in some other group. An entry is considered as existing
1739 ;; in another group if its name string-matches.
1740 ;;
1741 (yas/delete-from-keymap group-keymap name)
1742
1743 ;; ... then add this entry to the correct group
1744 (when (and (not (null group))
1745 (not (string= "" group)))
1746 (dolist (subgroup (mapcar #'make-symbol
1747 (split-string group "\\.")))
1748 (let ((subgroup-keymap (lookup-key group-keymap
1749 (vector subgroup))))
1750 (when (null subgroup-keymap)
1751 (setq subgroup-keymap (make-sparse-keymap))
1752 (define-key group-keymap (vector subgroup)
1753 `(menu-item ,(symbol-name subgroup)
1754 ,subgroup-keymap)))
1755 (setq group-keymap subgroup-keymap))))
1756 (define-key group-keymap (vector (gensym))
1757 `(menu-item ,(yas/template-name template)
1758 ,(yas/make-menu-binding template)
1759 :help ,name
1760 :keys ,(when (and key name)
1761 (concat key yas/trigger-symbol))))))))))
1762
1763(defun yas/show-menu-p (mode)
1764 (cond ((eq yas/use-menu 'abbreviate)
1765 (find mode
1766 (mapcar #'(lambda (table)
1767 (intern (yas/snippet-table-name table)))
1768 (yas/get-snippet-tables))))
1769 ((eq yas/use-menu 'real-modes)
1770 (yas/real-mode? mode))
1771 (t
1772 t)))
1773
1774(defun yas/delete-from-keymap (keymap name)
1775 "Recursively delete items name NAME from KEYMAP and its submenus.
1776
1777Skip any submenus named \"parent mode\""
1778 ;; First of all, recursively enter submenus, i.e. the tree is
1779 ;; searched depth first so that stale submenus can be found in the
1780 ;; higher passes.
1781 ;;
1782 (mapc #'(lambda (item)
1783 (when (and (keymapp (fourth item))
1784 (stringp (third item))
1785 (not (string-match "parent mode" (third item))))
1786 (yas/delete-from-keymap (fourth item) name)))
1787 (rest keymap))
1788 ;;
1789 (when (keymapp keymap)
1790 (let ((pos-in-keymap))
1791 (while (setq pos-in-keymap
1792 (position-if #'(lambda (item)
1793 (and (listp item)
1794 (or
1795 ;; the menu item we want to delete
1796 (and (eq 'menu-item (second item))
1797 (third item)
1798 (and (string= (third item) name)))
1799 ;; a stale subgroup
1800 (and (keymapp (fourth item))
1801 (not (and (stringp (third item))
1802 (string-match "parent mode"
1803 (third item))))
1804 (null (rest (fourth item)))))))
1805 keymap))
1806 (setf (nthcdr pos-in-keymap keymap)
1807 (nthcdr (+ 1 pos-in-keymap) keymap))))))
1808
1809(defun yas/define (mode key template &optional name condition group)
1810 "Define a snippet. Expanding KEY into TEMPLATE.
1811
1812NAME is a description to this template. Also update the menu if
1813`yas/use-menu' is `t'. CONDITION is the condition attached to
1814this snippet. If you attach a condition to a snippet, then it
1815will only be expanded when the condition evaluated to non-nil."
1816 (yas/define-snippets mode
1817 (list (list key template name condition group))))
1818
1819(defun yas/hippie-try-expand (first-time?)
1820 "Integrate with hippie expand. Just put this function in
1821`hippie-expand-try-functions-list'."
1822 (if (not first-time?)
1823 (let ((yas/fallback-behavior 'return-nil))
1824 (yas/expand))
1825 (undo 1)
1826 nil))
1827
1828(defun yas/expand ()
1829 "Expand a snippet before point.
1830
1831If no snippet expansion is possible, fall back to the behaviour
1832defined in `yas/fallback-behavior'"
1833 (interactive)
1834 (yas/expand-1))
1835
1836(defun yas/expand-1 (&optional field)
1837 "Actually fo the work for `yas/expand'"
1838 (multiple-value-bind (templates start end) (if field
1839 (save-restriction
1840 (narrow-to-region (yas/field-start field) (yas/field-end field))
1841 (yas/current-key))
1842 (yas/current-key))
1843 (if templates
1844 (let ((template (or (and (rest templates) ;; more than one
1845 (yas/prompt-for-template (mapcar #'cdr templates)))
1846 (cdar templates))))
1847 (when template
1848 (yas/expand-snippet (yas/template-content template)
1849 start
1850 end
1851 (yas/template-expand-env template))))
1852 (cond ((eq yas/fallback-behavior 'return-nil)
1853 ;; return nil
1854 nil)
1855 ((eq yas/fallback-behavior 'call-other-command)
1856 (let* ((yas/minor-mode nil)
1857 (keys-1 (this-command-keys-vector))
1858 (keys-2 (and yas/trigger-key
1859 (stringp yas/trigger-key)
1860 (read-kbd-macro yas/trigger-key)))
1861 (command-1 (and keys-1 (key-binding keys-1)))
1862 (command-2 (and keys-2 (key-binding keys-2)))
1863 (command (or (and (not (eq command-1 'yas/expand))
1864 command-1)
1865 command-2)))
1866 (when (and (commandp command)
1867 (not (eq 'yas/expand command)))
1868 (setq this-command command)
1869 (call-interactively command))))
1870 ((and (listp yas/fallback-behavior)
1871 (cdr yas/fallback-behavior)
1872 (eq 'apply (car yas/fallback-behavior)))
1873 (if (cddr yas/fallback-behavior)
1874 (apply (cadr yas/fallback-behavior)
1875 (cddr yas/fallback-behavior))
1876 (when (commandp (cadr yas/fallback-behavior))
1877 (setq this-command (cadr yas/fallback-behavior))
1878 (call-interactively (cadr yas/fallback-behavior)))))
1879 (t
1880 ;; also return nil if all the other fallbacks have failed
1881 nil)))))
1882
1883
1884;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1885;;; Snippet development
1886
1887(defun yas/all-templates (tables)
1888 "Return all snippet tables applicable for the current buffer.
1889
1890Honours `yas/choose-tables-first', `yas/choose-keys-first' and
1891`yas/buffer-local-condition'"
1892 (when yas/choose-tables-first
1893 (setq tables (list (yas/prompt-for-table tables))))
1894 (mapcar #'cdr
1895 (if yas/choose-keys-first
1896 (let ((key (yas/prompt-for-keys
1897 (mapcan #'yas/snippet-table-all-keys tables))))
1898 (when key
1899 (mapcan #'(lambda (table)
1900 (yas/fetch table key))
1901 tables)))
1902 (mapcan #'yas/snippet-table-templates tables))))
1903
1904(defun yas/insert-snippet (&optional no-condition)
1905 "Choose a snippet to expand, pop-up a list of choices according
1906to `yas/prompt-function'.
1907
1908With prefix argument NO-CONDITION, bypass filtering of snippets
1909by condition."
1910 (interactive "P")
1911 (let* ((yas/buffer-local-condition (or (and no-condition
1912 'always)
1913 yas/buffer-local-condition))
1914 (templates (yas/all-templates (yas/get-snippet-tables)))
1915 (template (and templates
1916 (or (and (rest templates) ;; more than one template for same key
1917 (yas/prompt-for-template templates))
1918 (car templates))))
1919 (where (if mark-active
1920 (cons (region-beginning) (region-end))
1921 (cons (point) (point)))))
1922 (if template
1923 (yas/expand-snippet (yas/template-content template)
1924 (car where)
1925 (cdr where)
1926 (yas/template-expand-env template))
1927 (message "[yas] No snippets can be inserted here!"))))
1928
1929(defun yas/visit-snippet-file ()
1930 "Choose a snippet to edit, selection like `yas/insert-snippet'.
1931
1932Only success if selected snippet was loaded from a file. Put the
1933visited file in `snippet-mode'."
1934 (interactive)
1935 (let* ((yas/buffer-local-condition 'always)
1936 (templates (yas/all-templates (yas/get-snippet-tables)))
1937 (template (and templates
1938 (or (and (rest templates) ;; more than one template for same key
1939 (yas/prompt-for-template templates
1940 "Choose a snippet template to edit: "))
1941 (car templates)))))
1942
1943 (when template
1944 (yas/visit-snippet-file-1 template))))
1945
1946(defun yas/visit-snippet-file-1 (template)
1947 (let ((file (yas/template-file template)))
1948 (cond ((and file (file-exists-p file))
1949 (find-file-other-window file)
1950 (snippet-mode))
1951 (file
1952 (message "Original file %s no longer exists!" file))
1953 (t
1954 (message "This snippet was not loaded from a file!")))))
1955
1956(defun yas/guess-snippet-directories-1 (table &optional suffix)
1957 "Guesses possible snippet subdirsdirectories for TABLE."
1958 (unless suffix
1959 (setq suffix (yas/snippet-table-name table)))
1960 (cons suffix
1961 (mapcan #'(lambda (parent)
1962 (yas/guess-snippet-directories-1
1963 parent
1964 (concat (yas/snippet-table-name parent) "/" suffix)))
1965 (yas/snippet-table-parents table))))
1966
1967(defun yas/guess-snippet-directories ()
1968 "Try to guess suitable directories based on the current active
1969tables.
1970
1971Returns a a list of options alist TABLE -> DIRS where DIRS are
1972all the possibly directories where snippets of table might be
1973lurking."
1974 (let ((main-dir (or (and (listp yas/root-directory)
1975 (first yas/root-directory))
1976 yas/root-directory
1977 (setq yas/root-directory "~/.emacs.d/snippets")))
1978 (tables (yas/get-snippet-tables)))
1979 ;; HACK! the snippet table created here is a dummy table that
1980 ;; holds the correct name so that `yas/make-directory-maybe' can
1981 ;; work. The real table, if it does not exist in
1982 ;; yas/snippet-tables will be created when the first snippet for
1983 ;; that mode is loaded.
1984 ;;
1985 (unless (gethash major-mode yas/snippet-tables)
1986 (setq tables (cons (yas/make-snippet-table (symbol-name major-mode))
1987 tables)))
1988
1989 (mapcar #'(lambda (table)
1990 (cons table
1991 (mapcar #'(lambda (subdir)
1992 (concat main-dir "/" subdir))
1993 (yas/guess-snippet-directories-1 table))))
1994 tables)))
1995
1996(defun yas/make-directory-maybe (table-and-dirs &optional main-table-string)
1997 "Returns a dir inside TABLE-AND-DIRS, prompts for creation if none exists."
1998 (or (some #'(lambda (dir) (when (file-directory-p dir) dir)) (cdr table-and-dirs))
1999 (let ((candidate (first (cdr table-and-dirs))))
2000 (if (y-or-n-p (format "Guessed directory (%s) for%s%s table \"%s\" does not exist! Create? "
2001 candidate
2002 (if (gethash (intern (yas/snippet-table-name (car table-and-dirs)))
2003 yas/snippet-tables)
2004 ""
2005 " brand new")
2006 (or main-table-string
2007 "")
2008 (yas/snippet-table-name (car table-and-dirs))))
2009 (progn
2010 (make-directory candidate 'also-make-parents)
2011 ;; create the .yas-parents file here...
2012 candidate)))))
2013
2014(defun yas/new-snippet (&optional choose-instead-of-guess)
2015 ""
2016 (interactive "P")
2017 (let* ((guessed-directories (yas/guess-snippet-directories))
2018 (option (or (and choose-instead-of-guess
2019 (some #'(lambda (fn)
2020 (funcall fn "Choose a snippet table: "
2021 guessed-directories
2022 #'(lambda (option)
2023 (yas/snippet-table-name (car option)))))
2024 yas/prompt-functions))
2025 (first guessed-directories)))
2026 (chosen))
2027 (setq chosen (yas/make-directory-maybe option (unless choose-instead-of-guess
2028 " main")))
2029 (unless (or chosen
2030 choose-instead-of-guess)
2031 (if (y-or-n-p (format "Continue guessing for other active tables %s? "
2032 (mapcar #'(lambda (table-and-dirs)
2033 (yas/snippet-table-name (car table-and-dirs)))
2034 (rest guessed-directories))))
2035 (setq chosen (some #'yas/make-directory-maybe
2036 (rest guessed-directories)))))
2037 (unless (or chosen
2038 choose-instead-of-guess)
2039 (when (y-or-n-p "Having trouble... use snippet root dir? ")
2040 (setq chosen (if (listp yas/root-directory)
2041 (first yas/root-directory)
2042 yas/root-directory))))
2043 (if chosen
2044 (let ((default-directory chosen)
2045 (name (read-from-minibuffer "Enter a snippet name: ")))
2046 (find-file-other-window (concat name
2047 ".yasnippet"))
2048 (snippet-mode)
2049 (unless (and choose-instead-of-guess
2050 (not (y-or-n-p "Insert a snippet with useful headers? ")))
2051 (yas/expand-snippet (format
2052 "\
2053# -*- mode: snippet -*-
2054# name: %s
2055# key: $1${2:
2056# binding: \"${3:keybinding}\"}${4:
2057# expand-env: ((${5:some-var} ${6:some-value}))}
2058# --
2059$0" name))))
2060 (message "[yas] aborted snippet creation."))))
2061
2062(defun yas/find-snippets (&optional same-window )
2063 "Look for user snippets in guessed current mode's directory.
2064
2065Calls `find-file' interactively in the guessed directory.
2066
2067With prefix arg SAME-WINDOW opens the buffer in the same window.
2068
2069Because snippets can be loaded from many different locations,
2070this has to guess the correct directory using
2071`yas/guess-snippet-directories', which returns a list of
2072options.
2073
2074If any one of these exists, it is taken and `find-file' is called
2075there, otherwise, proposes to create the first option returned by
2076`yas/guess-snippet-directories'."
2077 (interactive "P")
2078 (let* ((guessed-directories (yas/guess-snippet-directories))
2079 (chosen)
2080 (buffer))
2081 (setq chosen (yas/make-directory-maybe (first guessed-directories) " main"))
2082 (unless chosen
2083 (if (y-or-n-p (format "Continue guessing for other active tables %s? "
2084 (mapcar #'(lambda (table-and-dirs)
2085 (yas/snippet-table-name (car table-and-dirs)))
2086 (rest guessed-directories))))
2087 (setq chosen (some #'yas/make-directory-maybe
2088 (rest guessed-directories)))))
2089 (unless chosen
2090 (when (y-or-n-p "Having trouble... go to snippet root dir? ")
2091 (setq chosen (if (listp yas/root-directory)
2092 (first yas/root-directory)
2093 yas/root-directory))))
2094 (if chosen
2095 (let ((default-directory chosen))
2096 (setq buffer (call-interactively (if same-window
2097 'find-file
2098 'find-file-other-window)))
2099 (when buffer
2100 (save-excursion
2101 (set-buffer buffer)
2102 (when (eq major-mode 'fundamental-mode)
2103 (snippet-mode)))))
2104 (message "Could not guess snippet dir!"))))
2105
2106(defun yas/compute-major-mode-and-parents (file &optional prompt-if-failed no-hierarchy-parents)
2107 (let* ((file-dir (and file
2108 (directory-file-name (or (locate-dominating-file file ".yas-make-groups")
2109 (directory-file-name (file-name-directory file))))))
2110 (major-mode-name (and file-dir
2111 (file-name-nondirectory file-dir)))
2112 (parent-file-dir (and file-dir
2113 (directory-file-name (file-name-directory file-dir))))
2114 (parent-mode-name (and parent-file-dir
2115 (not no-hierarchy-parents)
2116 (file-name-nondirectory parent-file-dir)))
2117 (major-mode-sym (or (and major-mode-name
2118 (intern major-mode-name))
2119 (when prompt-if-failed
2120 (read-from-minibuffer
2121 "[yas] Cannot auto-detect major mode! Enter a major mode: "))))
2122 (parent-mode-sym (and parent-mode-name
2123 (intern parent-mode-name)))
2124 (extra-parents-file-name (concat file-dir "/.yas-parents"))
2125 (more-parents (when (file-readable-p extra-parents-file-name)
2126 (mapcar #'intern
2127 (split-string
2128 (with-temp-buffer
2129 (insert-file-contents extra-parents-file-name)
2130 (buffer-substring-no-properties (point-min)
2131 (point-max))))))))
2132 (when major-mode-sym
2133 (remove nil (append (list major-mode-sym parent-mode-sym)
2134 more-parents)))))
2135
2136(defun yas/load-snippet-buffer (&optional kill)
2137 "Parse and load current buffer's snippet definition.
2138
2139With optional prefix argument KILL quit the window and buffer."
2140 (interactive "P")
2141 (if buffer-file-name
2142 (let ((major-mode-and-parent (yas/compute-major-mode-and-parents buffer-file-name)))
2143 (if major-mode-and-parent
2144 (let* ((parsed (yas/parse-template buffer-file-name))
2145 (name (and parsed
2146 (third parsed))))
2147 (when name
2148 (let ((yas/better-guess-for-replacements t))
2149 (yas/define-snippets (car major-mode-and-parent)
2150 (list parsed)
2151 (cdr major-mode-and-parent)))
2152 (when (and (buffer-modified-p)
2153 (y-or-n-p "Save snippet? "))
2154 (save-buffer))
2155 (if kill
2156 (quit-window kill)
2157 (message "[yas] Snippet \"%s\" loaded for %s."
2158 name
2159 (car major-mode-and-parent)))))
2160 (message "[yas] Cannot load snippet for unknown major mode")))
2161 (message "Save the buffer as a file first!")))
2162
2163(defun yas/tryout-snippet (&optional debug)
2164 "Test current buffers's snippet template in other buffer."
2165 (interactive "P")
2166 (let* ((major-mode-and-parent (yas/compute-major-mode-and-parents buffer-file-name))
2167 (parsed (yas/parse-template))
2168 (test-mode (or (and (car major-mode-and-parent)
2169 (fboundp (car major-mode-and-parent))
2170 (car major-mode-and-parent))
2171 (intern (read-from-minibuffer "[yas] please input a mode: "))))
2172 (template (and parsed
2173 (fboundp test-mode)
2174 (yas/make-template (second parsed)
2175 (third parsed)
2176 nil
2177 (sixth parsed)
2178 nil
2179 nil))))
2180 (cond (template
2181 (let ((buffer-name (format "*YAS TEST: %s*" (yas/template-name template))))
2182 (set-buffer (switch-to-buffer buffer-name))
2183 (erase-buffer)
2184 (setq buffer-undo-list nil)
2185 (funcall test-mode)
2186 (yas/expand-snippet (yas/template-content template)
2187 (point-min)
2188 (point-max)
2189 (yas/template-expand-env template))
2190 (when debug
2191 (add-hook 'post-command-hook 'yas/debug-snippet-vars 't 'local))))
2192 (t
2193 (message "[yas] Cannot test snippet for unknown major mode")))))
2194
2195
2196;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2197;;; User convenience functions, for using in snippet definitions
2198
2199(defvar yas/modified-p nil
2200 "Non-nil if field has been modified by user or transformation.")
2201
2202(defvar yas/moving-away-p nil
2203 "Non-nil if user is about to exit field.")
2204
2205(defvar yas/text nil
2206 "Contains current field text.")
2207
2208(defun yas/substr (str pattern &optional subexp)
2209 "Search PATTERN in STR and return SUBEXPth match.
2210
2211If found, the content of subexp group SUBEXP (default 0) is
2212 returned, or else the original STR will be returned."
2213 (let ((grp (or subexp 0)))
2214 (save-match-data
2215 (if (string-match pattern str)
2216 (match-string-no-properties grp str)
2217 str))))
2218
2219(defun yas/choose-value (possibilities)
2220 "Prompt for a string in the list POSSIBILITIES and return it."
2221 (unless (or yas/moving-away-p
2222 yas/modified-p)
2223 (some #'(lambda (fn)
2224 (funcall fn "Choose: " possibilities))
2225 yas/prompt-functions)))
2226
2227(defun yas/key-to-value (alist)
2228 "Prompt for a string in the list POSSIBILITIES and return it."
2229 (unless (or yas/moving-away-p
2230 yas/modified-p)
2231 (let ((key (read-key-sequence "")))
2232 (when (stringp key)
2233 (or (cdr (find key alist :key #'car :test #'string=))
2234 key)))))
2235
2236(defun yas/throw (text)
2237 "Throw a yas/exception with TEXT as the reason."
2238 (throw 'yas/exception (cons 'yas/exception text)))
2239
2240(defun yas/verify-value (possibilities)
2241 "Verify that the current field value is in POSSIBILITIES
2242
2243Otherwise throw exception."
2244 (when (and yas/moving-away-p (notany #'(lambda (pos) (string= pos yas/text)) possibilities))
2245 (yas/throw (format "[yas] field only allows %s" possibilities))))
2246
2247(defun yas/field-value (number)
2248 (let* ((snippet (car (yas/snippets-at-point)))
2249 (field (and snippet
2250 (yas/snippet-find-field snippet number))))
2251 (when field
2252 (yas/field-text-for-display field))))
2253
2254(defun yas/default-from-field (number)
2255 (unless yas/modified-p
2256 (yas/field-value number)))
2257
2258(defun yas/inside-string ()
2259 (equal 'font-lock-string-face (get-char-property (1- (point)) 'face)))
2260
2261
2262;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2263;;; Snippet expansion and field management
2264
2265(defvar yas/active-field-overlay nil
2266 "Overlays the currently active field.")
2267
2268(defvar yas/field-protection-overlays nil
2269 "Two overlays protect the current active field ")
2270
2271(defconst yas/prefix nil
2272 "A prefix argument for expansion direct from keybindings")
2273
2274(defvar yas/deleted-text nil
2275 "The text deleted in the last snippet expansion.")
2276
2277(defvar yas/selected-text nil
2278 "The selected region deleted on the last snippet expansion.")
2279
2280(defvar yas/start-column nil
2281 "The column where the snippet expansion started.")
2282
2283(make-variable-buffer-local 'yas/active-field-overlay)
2284(make-variable-buffer-local 'yas/field-protection-overlays)
2285(make-variable-buffer-local 'yas/deleted-text)
2286
2287(defstruct (yas/snippet (:constructor yas/make-snippet ()))
2288 "A snippet.
2289
2290..."
2291 (fields '())
2292 (exit nil)
2293 (id (yas/snippet-next-id) :read-only t)
2294 (control-overlay nil)
2295 active-field
2296 ;; stacked expansion: the `previous-active-field' slot saves the
2297 ;; active field where the child expansion took place
2298 previous-active-field
2299 force-exit)
2300
2301(defstruct (yas/field (:constructor yas/make-field (number start end parent-field)))
2302 "A field."
2303 number
2304 start end
2305 parent-field
2306 (mirrors '())
2307 (transform nil)
2308 (modified-p nil)
2309 next)
2310
2311(defstruct (yas/mirror (:constructor yas/make-mirror (start end transform)))
2312 "A mirror."
2313 start end
2314 (transform nil)
2315 next)
2316
2317(defstruct (yas/exit (:constructor yas/make-exit (marker)))
2318 marker
2319 next)
2320
2321(defun yas/apply-transform (field-or-mirror field)
2322 "Calculate the value of the field/mirror. If there's a transform
2323for this field, apply it. Otherwise, returned nil."
2324 (let* ((yas/text (yas/field-text-for-display field))
2325 (text yas/text)
2326 (yas/modified-p (yas/field-modified-p field))
2327 (yas/moving-away-p nil)
2328 (transform (if (yas/mirror-p field-or-mirror)
2329 (yas/mirror-transform field-or-mirror)
2330 (yas/field-transform field-or-mirror)))
2331 (start-point (if (yas/mirror-p field-or-mirror)
2332 (yas/mirror-start field-or-mirror)
2333 (yas/field-start field-or-mirror)))
2334 (transformed (and transform
2335 (save-excursion
2336 (goto-char start-point)
2337 (yas/read-and-eval-string transform)))))
2338 transformed))
2339
2340(defsubst yas/replace-all (from to &optional text)
2341 "Replace all occurance from FROM to TO.
2342
2343With optional string TEXT do it in that string."
2344 (if text
2345 (replace-regexp-in-string (regexp-quote from) to text t t)
2346 (goto-char (point-min))
2347 (while (search-forward from nil t)
2348 (replace-match to t t text))))
2349
2350(defun yas/snippet-find-field (snippet number)
2351 (find-if #'(lambda (field)
2352 (eq number (yas/field-number field)))
2353 (yas/snippet-fields snippet)))
2354
2355(defun yas/snippet-sort-fields (snippet)
2356 "Sort the fields of SNIPPET in navigation order."
2357 (setf (yas/snippet-fields snippet)
2358 (sort (yas/snippet-fields snippet)
2359 '(lambda (field1 field2)
2360 (yas/snippet-field-compare field1 field2)))))
2361
2362(defun yas/snippet-field-compare (field1 field2)
2363 "Compare two fields. The field with a number is sorted first.
2364If they both have a number, compare through the number. If neither
2365have, compare through the field's start point"
2366 (let ((n1 (yas/field-number field1))
2367 (n2 (yas/field-number field2)))
2368 (if n1
2369 (if n2
2370 (< n1 n2)
2371 t)
2372 (if n2
2373 nil
2374 (< (yas/field-start field1)
2375 (yas/field-start field2))))))
2376
2377(defun yas/field-probably-deleted-p (snippet field)
2378 "Guess if SNIPPET's FIELD should be skipped."
2379 (and (zerop (- (yas/field-start field) (yas/field-end field)))
2380 (or (yas/field-parent-field field)
2381 (and (eq field (car (last (yas/snippet-fields snippet))))
2382 (= (yas/field-start field) (overlay-end (yas/snippet-control-overlay snippet)))))))
2383
2384(defun yas/snippets-at-point (&optional all-snippets)
2385 "Return a sorted list of snippets at point, most recently
2386inserted first."
2387 (sort
2388 (remove nil (remove-duplicates (mapcar #'(lambda (ov)
2389 (overlay-get ov 'yas/snippet))
2390 (if all-snippets
2391 (overlays-in (point-min) (point-max))
2392 (overlays-at (point))))))
2393 #'(lambda (s1 s2)
2394 (<= (yas/snippet-id s2) (yas/snippet-id s1)))))
2395
2396(defun yas/next-field-or-maybe-expand ()
2397 "Try to expand a snippet at a key before point, otherwise
2398delegate to `yas/next-field'."
2399 (interactive)
2400 (if yas/triggers-in-field
2401 (let ((yas/fallback-behavior 'return-nil)
2402 (active-field (overlay-get yas/active-field-overlay 'yas/field)))
2403 (when active-field
2404 (unless (yas/expand-1 active-field)
2405 (yas/next-field))))
2406 (yas/next-field)))
2407
2408(defun yas/next-field (&optional arg)
2409 "Navigate to next field. If there's none, exit the snippet."
2410 (interactive)
2411 (let* ((arg (or arg
2412 1))
2413 (snippet (first (yas/snippets-at-point)))
2414 (active-field (overlay-get yas/active-field-overlay 'yas/field))
2415 (live-fields (remove-if #'(lambda (field)
2416 (and (not (eq field active-field))
2417 (yas/field-probably-deleted-p snippet field)))
2418 (yas/snippet-fields snippet)))
2419 (active-field-pos (position active-field live-fields))
2420 (target-pos (and active-field-pos (+ arg active-field-pos)))
2421 (target-field (nth target-pos live-fields)))
2422 ;; First check if we're moving out of a field with a transform
2423 ;;
2424 (when (and active-field
2425 (yas/field-transform active-field))
2426 (let* ((yas/moving-away-p t)
2427 (yas/text (yas/field-text-for-display active-field))
2428 (text yas/text)
2429 (yas/modified-p (yas/field-modified-p active-field)))
2430 ;; primary field transform: exit call to field-transform
2431 (yas/read-and-eval-string (yas/field-transform active-field))))
2432 ;; Now actually move...
2433 (cond ((>= target-pos (length live-fields))
2434 (yas/exit-snippet snippet))
2435 (target-field
2436 (yas/move-to-field snippet target-field))
2437 (t
2438 nil))))
2439
2440(defun yas/place-overlays (snippet field)
2441 "Correctly place overlays for SNIPPET's FIELD"
2442 (yas/make-move-field-protection-overlays snippet field)
2443 (yas/make-move-active-field-overlay snippet field))
2444
2445(defun yas/move-to-field (snippet field)
2446 "Update SNIPPET to move to field FIELD.
2447
2448Also create some protection overlays"
2449 (goto-char (yas/field-start field))
2450 (setf (yas/snippet-active-field snippet) field)
2451 (yas/place-overlays snippet field)
2452 (overlay-put yas/active-field-overlay 'yas/field field)
2453 ;; primary field transform: first call to snippet transform
2454 (unless (yas/field-modified-p field)
2455 (if (yas/field-update-display field snippet)
2456 (let ((inhibit-modification-hooks t))
2457 (yas/update-mirrors snippet))
2458 (setf (yas/field-modified-p field) nil))))
2459
2460(defun yas/prev-field ()
2461 "Navigate to prev field. If there's none, exit the snippet."
2462 (interactive)
2463 (yas/next-field -1))
2464
2465(defun yas/abort-snippet (&optional snippet)
2466 (interactive)
2467 (let ((snippet (or snippet
2468 (car (yas/snippets-at-point)))))
2469 (when snippet
2470 (setf (yas/snippet-force-exit snippet) t))))
2471
2472(defun yas/exit-snippet (snippet)
2473 "Goto exit-marker of SNIPPET."
2474 (interactive)
2475 (setf (yas/snippet-force-exit snippet) t)
2476 (goto-char (if (yas/snippet-exit snippet)
2477 (yas/exit-marker (yas/snippet-exit snippet))
2478 (overlay-end (yas/snippet-control-overlay snippet)))))
2479
2480(defun yas/exit-all-snippets ()
2481 "Exit all snippets."
2482 (interactive)
2483 (mapc #'(lambda (snippet)
2484 (yas/exit-snippet snippet)
2485 (yas/check-commit-snippet))
2486 (yas/snippets-at-point)))
2487
2488
2489;;; Apropos markers-to-points:
2490;;;
2491;;; This was found useful for performance reasons, so that an
2492;;; excessive number of live markers aren't kept around in the
2493;;; `buffer-undo-list'. However, in `markers-to-points', the
2494;;; set-to-nil markers can't simply be discarded and replaced with
2495;;; fresh ones in `points-to-markers'. The original marker that was
2496;;; just set to nil has to be reused.
2497;;;
2498;;; This shouldn't bring horrible problems with undo/redo, but it
2499;;; you never know
2500;;;
2501
2502(defun yas/markers-to-points (snippet)
2503 "Convert all markers in SNIPPET to a cons (POINT . MARKER)
2504where POINT is the original position of the marker and MARKER is
2505the original marker object with the position set to nil."
2506 (dolist (field (yas/snippet-fields snippet))
2507 (let ((start (marker-position (yas/field-start field)))
2508 (end (marker-position (yas/field-end field))))
2509 (set-marker (yas/field-start field) nil)
2510 (set-marker (yas/field-end field) nil)
2511 (setf (yas/field-start field) (cons start (yas/field-start field)))
2512 (setf (yas/field-end field) (cons end (yas/field-end field))))
2513 (dolist (mirror (yas/field-mirrors field))
2514 (let ((start (marker-position (yas/mirror-start mirror)))
2515 (end (marker-position (yas/mirror-end mirror))))
2516 (set-marker (yas/mirror-start mirror) nil)
2517 (set-marker (yas/mirror-end mirror) nil)
2518 (setf (yas/mirror-start mirror) (cons start (yas/mirror-start mirror)))
2519 (setf (yas/mirror-end mirror) (cons end (yas/mirror-end mirror))))))
2520 (let ((snippet-exit (yas/snippet-exit snippet)))
2521 (when snippet-exit
2522 (let ((exit (marker-position (yas/exit-marker snippet-exit))))
2523 (set-marker (yas/exit-marker snippet-exit) nil)
2524 (setf (yas/exit-marker snippet-exit) (cons exit (yas/exit-marker snippet-exit)))))))
2525
2526(defun yas/points-to-markers (snippet)
2527 "Convert all cons (POINT . MARKER) in SNIPPET to markers. This
2528is done by setting MARKER to POINT with `set-marker'."
2529 (dolist (field (yas/snippet-fields snippet))
2530 (setf (yas/field-start field) (set-marker (cdr (yas/field-start field))
2531 (car (yas/field-start field))))
2532 (setf (yas/field-end field) (set-marker (cdr (yas/field-end field))
2533 (car (yas/field-end field))))
2534 (dolist (mirror (yas/field-mirrors field))
2535 (setf (yas/mirror-start mirror) (set-marker (cdr (yas/mirror-start mirror))
2536 (car (yas/mirror-start mirror))))
2537 (setf (yas/mirror-end mirror) (set-marker (cdr (yas/mirror-end mirror))
2538 (car (yas/mirror-end mirror))))))
2539 (let ((snippet-exit (yas/snippet-exit snippet)))
2540 (when snippet-exit
2541 (setf (yas/exit-marker snippet-exit) (set-marker (cdr (yas/exit-marker snippet-exit))
2542 (car (yas/exit-marker snippet-exit)))))))
2543
2544(defun yas/commit-snippet (snippet &optional no-hooks)
2545 "Commit SNIPPET, but leave point as it is. This renders the
2546snippet as ordinary text.
2547
2548Return a buffer position where the point should be placed if
2549exiting the snippet.
2550
2551NO-HOOKS means don't run the `yas/after-exit-snippet-hook' hooks."
2552
2553 (let ((control-overlay (yas/snippet-control-overlay snippet))
2554 yas/snippet-beg
2555 yas/snippet-end)
2556 ;;
2557 ;; Save the end of the moribund snippet in case we need to revive it
2558 ;; its original expansion.
2559 ;;
2560 (when (and control-overlay
2561 (overlay-buffer control-overlay))
2562 (setq yas/snippet-beg (overlay-start control-overlay))
2563 (setq yas/snippet-end (overlay-end control-overlay))
2564 (delete-overlay control-overlay))
2565
2566 (let ((inhibit-modification-hooks t))
2567 (when yas/active-field-overlay
2568 (delete-overlay yas/active-field-overlay))
2569 (when yas/field-protection-overlays
2570 (mapc #'delete-overlay yas/field-protection-overlays)))
2571
2572 ;; stacked expansion: if the original expansion took place from a
2573 ;; field, make sure we advance it here at least to
2574 ;; `yas/snippet-end'...
2575 ;;
2576 (let ((previous-field (yas/snippet-previous-active-field snippet)))
2577 (when (and yas/snippet-end previous-field)
2578 (yas/advance-end-maybe previous-field yas/snippet-end)))
2579
2580 ;; Convert all markers to points,
2581 ;;
2582 (yas/markers-to-points snippet)
2583
2584 ;; Take care of snippet revival
2585 ;;
2586 (if yas/snippet-revival
2587 (push `(apply yas/snippet-revive ,yas/snippet-beg ,yas/snippet-end ,snippet)
2588 buffer-undo-list)
2589 ;; Dismember the snippet... this is useful if we get called
2590 ;; again from `yas/take-care-of-redo'....
2591 (setf (yas/snippet-fields snippet) nil))
2592
2593 ;; XXX: `yas/after-exit-snippet-hook' should be run with
2594 ;; `yas/snippet-beg' and `yas/snippet-end' bound. That might not
2595 ;; be the case if the main overlay had somehow already
2596 ;; disappeared, which sometimes happens when the snippet's messed
2597 ;; up...
2598 ;;
2599 (unless no-hooks (run-hooks 'yas/after-exit-snippet-hook)))
2600
2601 (message "[yas] snippet exited."))
2602
2603(defun yas/check-commit-snippet ()
2604 "Checks if point exited the currently active field of the
2605snippet, if so cleans up the whole snippet up."
2606 (let* ((snippets (yas/snippets-at-point 'all-snippets))
2607 (snippets-left snippets))
2608 (dolist (snippet snippets)
2609 (let ((active-field (yas/snippet-active-field snippet)))
2610 (cond ((or (prog1 (yas/snippet-force-exit snippet)
2611 (setf (yas/snippet-force-exit snippet) nil))
2612 (not (and active-field (yas/field-contains-point-p active-field))))
2613 (setq snippets-left (delete snippet snippets-left))
2614 (yas/commit-snippet snippet snippets-left))
2615 ((and active-field
2616 (or (not yas/active-field-overlay)
2617 (not (overlay-buffer yas/active-field-overlay))))
2618 ;;
2619 ;; stacked expansion: this case is mainly for recent
2620 ;; snippet exits that place us back int the field of
2621 ;; another snippet
2622 ;;
2623 (save-excursion
2624 (yas/move-to-field snippet active-field)
2625 (yas/update-mirrors snippet)))
2626 (t
2627 nil))))
2628 (unless snippets-left
2629 (remove-hook 'post-command-hook 'yas/post-command-handler 'local)
2630 (remove-hook 'pre-command-hook 'yas/pre-command-handler 'local))))
2631
2632(defun yas/field-contains-point-p (field &optional point)
2633 (let ((point (or point
2634 (point))))
2635 (and (>= point (yas/field-start field))
2636 (<= point (yas/field-end field)))))
2637
2638(defun yas/field-text-for-display (field)
2639 "Return the propertized display text for field FIELD. "
2640 (buffer-substring (yas/field-start field) (yas/field-end field)))
2641
2642(defun yas/undo-in-progress ()
2643 "True if some kind of undo is in progress"
2644 (or undo-in-progress
2645 (eq this-command 'undo)
2646 (eq this-command 'redo)))
2647
2648(defun yas/make-control-overlay (snippet start end)
2649 "Creates the control overlay that surrounds the snippet and
2650holds the keymap."
2651 (let ((overlay (make-overlay start
2652 end
2653 nil
2654 nil
2655 t)))
2656 (overlay-put overlay 'keymap yas/keymap)
2657 (overlay-put overlay 'yas/snippet snippet)
2658 overlay))
2659
2660(defun yas/skip-and-clear-or-delete-char (&optional field)
2661 "Clears unmodified field if at field start, skips to next tab.
2662
2663Otherwise deletes a character normally by calling `delete-char'."
2664 (interactive)
2665 (let ((field (or field
2666 (and yas/active-field-overlay
2667 (overlay-buffer yas/active-field-overlay)
2668 (overlay-get yas/active-field-overlay 'yas/field)))))
2669 (cond ((and field
2670 (not (yas/field-modified-p field))
2671 (eq (point) (marker-position (yas/field-start field))))
2672 (yas/skip-and-clear field)
2673 (yas/next-field 1))
2674 (t
2675 (call-interactively 'delete-char)))))
2676
2677(defun yas/skip-and-clear (field)
2678 "Deletes the region of FIELD and sets it modified state to t"
2679 (setf (yas/field-modified-p field) t)
2680 (delete-region (yas/field-start field) (yas/field-end field)))
2681
2682(defun yas/make-move-active-field-overlay (snippet field)
2683 "Place the active field overlay in SNIPPET's FIELD.
2684
2685Move the overlay, or create it if it does not exit."
2686 (if (and yas/active-field-overlay
2687 (overlay-buffer yas/active-field-overlay))
2688 (move-overlay yas/active-field-overlay
2689 (yas/field-start field)
2690 (yas/field-end field))
2691 (setq yas/active-field-overlay
2692 (make-overlay (yas/field-start field)
2693 (yas/field-end field)
2694 nil nil t))
2695 (overlay-put yas/active-field-overlay 'priority 100)
2696 (overlay-put yas/active-field-overlay 'face 'yas/field-highlight-face)
2697 (overlay-put yas/active-field-overlay 'yas/snippet snippet)
2698 (overlay-put yas/active-field-overlay 'modification-hooks '(yas/on-field-overlay-modification))
2699 (overlay-put yas/active-field-overlay 'insert-in-front-hooks
2700 '(yas/on-field-overlay-modification))
2701 (overlay-put yas/active-field-overlay 'insert-behind-hooks
2702 '(yas/on-field-overlay-modification))))
2703
2704(defun yas/on-field-overlay-modification (overlay after? beg end &optional length)
2705 "Clears the field and updates mirrors, conditionally.
2706
2707Only clears the field if it hasn't been modified and it point it
2708at field start. This hook doesn't do anything if an undo is in
2709progress."
2710 (unless (yas/undo-in-progress)
2711 (let ((field (overlay-get yas/active-field-overlay 'yas/field)))
2712 (cond (after?
2713 (yas/advance-end-maybe field (overlay-end overlay))
2714;;; primary field transform: normal calls to expression
2715 (let ((saved-point (point)))
2716 (yas/field-update-display field (car (yas/snippets-at-point)))
2717 (goto-char saved-point))
2718 (yas/update-mirrors (car (yas/snippets-at-point))))
2719 (field
2720 (when (and (not after?)
2721 (not (yas/field-modified-p field))
2722 (eq (point) (if (markerp (yas/field-start field))
2723 (marker-position (yas/field-start field))
2724 (yas/field-start field))))
2725 (yas/skip-and-clear field))
2726 (setf (yas/field-modified-p field) t))))))
2727
2728;;; Apropos protection overlays:
2729;;;
2730;;; These exist for nasty users who will try to delete parts of the
2731;;; snippet outside the active field. Actual protection happens in
2732;;; `yas/on-protection-overlay-modification'.
2733;;;
2734;;; Currently this signals an error which inhibits the command. For
2735;;; commands that move point (like `kill-line'), point is restored in
2736;;; the `yas/post-command-handler' using a global
2737;;; `yas/protection-violation' variable.
2738;;;
2739;;; Alternatively, I've experimented with an implementation that
2740;;; commits the snippet before actually calling `this-command'
2741;;; interactively, and then signals an eror, which is ignored. but
2742;;; blocks all other million modification hooks. This presented some
2743;;; problems with stacked expansion.
2744;;;
2745
2746(defun yas/make-move-field-protection-overlays (snippet field)
2747 "Place protection overlays surrounding SNIPPET's FIELD.
2748
2749Move the overlays, or create them if they do not exit."
2750 (let ((start (yas/field-start field))
2751 (end (yas/field-end field)))
2752 ;; First check if the (1+ end) is contained in the buffer,
2753 ;; otherwise we'll have to do a bit of cheating and silently
2754 ;; insert a newline. the `(1+ (buffer-size))' should prevent this
2755 ;; when using stacked expansion
2756 ;;
2757 (when (< (buffer-size) end)
2758 (save-excursion
2759 (let ((inhibit-modification-hooks t))
2760 (goto-char (point-max))
2761 (newline))))
2762 ;; go on to normal overlay creation/moving
2763 ;;
2764 (cond ((and yas/field-protection-overlays
2765 (every #'overlay-buffer yas/field-protection-overlays))
2766 (move-overlay (first yas/field-protection-overlays) (1- start) start)
2767 (move-overlay (second yas/field-protection-overlays) end (1+ end)))
2768 (t
2769 (setq yas/field-protection-overlays
2770 (list (make-overlay (1- start) start nil t nil)
2771 (make-overlay end (1+ end) nil t nil)))
2772 (dolist (ov yas/field-protection-overlays)
2773 (overlay-put ov 'face 'yas/field-debug-face)
2774 (overlay-put ov 'yas/snippet snippet)
2775 ;; (overlay-put ov 'evaporate t)
2776 (overlay-put ov 'modification-hooks '(yas/on-protection-overlay-modification)))))))
2777
2778(defvar yas/protection-violation nil
2779 "When non-nil, signals attempts to erronesly exit or modify the snippet.
2780
2781Functions in the `post-command-hook', for example
2782`yas/post-command-handler' can check it and reset its value to
2783nil. The variables value is the point where the violation
2784originated")
2785
2786(defun yas/on-protection-overlay-modification (overlay after? beg end &optional length)
2787 "Signals a snippet violation, then issues error.
2788
2789The error should be ignored in `debug-ignored-errors'"
2790 (cond ((not (or after?
2791 (yas/undo-in-progress)))
2792 (setq yas/protection-violation (point))
2793 (error "Exit the snippet first!"))))
2794
2795(add-to-list 'debug-ignored-errors "^Exit the snippet first!$")
2796
2797
2798;;; Apropos stacked expansion:
2799;;;
2800;;; the parent snippet does not run its fields modification hooks
2801;;; (`yas/on-field-overlay-modification' and
2802;;; `yas/on-protection-overlay-modification') while the child snippet
2803;;; is active. This means, among other things, that the mirrors of the
2804;;; parent snippet are not updated, this only happening when one exits
2805;;; the child snippet.
2806;;;
2807;;; Unfortunately, this also puts some ugly (and not fully-tested)
2808;;; bits of code in `yas/expand-snippet' and
2809;;; `yas/commit-snippet'. I've tried to mark them with "stacked
2810;;; expansion:".
2811;;;
2812;;; This was thought to be safer in in an undo/redo perpective, but
2813;;; maybe the correct implementation is to make the globals
2814;;; `yas/active-field-overlay' and `yas/field-protection-overlays' be
2815;;; snippet-local and be active even while the child snippet is
2816;;; running. This would mean a lot of overlay modification hooks
2817;;; running, but if managed correctly (including overlay priorities)
2818;;; they should account for all situations...
2819;;;
2820
2821(defun yas/expand-snippet (template &optional start end expand-env)
2822 "Expand snippet at current point. Text between START and END
2823will be deleted before inserting template."
2824 (run-hooks 'yas/before-expand-snippet-hook)
2825
2826 ;; If a region is active, set `yas/selected-text'
2827 (setq yas/selected-text
2828 (when mark-active
2829 (prog1 (buffer-substring-no-properties (region-beginning)
2830 (region-end))
2831 (unless start (setq start (region-beginning))
2832 (unless end (setq end (region-end)))))))
2833
2834 (when start
2835 (goto-char start))
2836
2837 ;; stacked expansion: shoosh the overlay modification hooks
2838 ;;
2839 (let ((to-delete (and start end (buffer-substring-no-properties start end)))
2840 (start (or start (point)))
2841 (end (or end (point)))
2842 (inhibit-modification-hooks t)
2843 (column (current-column))
2844 snippet)
2845
2846 ;; Delete the region to delete, this *does* get undo-recorded.
2847 ;;
2848 (when (and to-delete
2849 (> end start))
2850 (delete-region start end)
2851 (setq yas/deleted-text to-delete))
2852
2853 ;; Narrow the region down to the template, shoosh the
2854 ;; `buffer-undo-list', and create the snippet, the new snippet
2855 ;; updates its mirrors once, so we are left with some plain text.
2856 ;; The undo action for deleting this plain text will get recorded
2857 ;; at the end of this function.
2858 (save-restriction
2859 (narrow-to-region start start)
2860 (let ((buffer-undo-list t))
2861 ;; snippet creation might evaluate users elisp, which
2862 ;; might generate errors, so we have to be ready to catch
2863 ;; them mostly to make the undo information
2864 ;;
2865 (setq yas/start-column (save-restriction (widen) (current-column)))
2866 (insert template)
2867
2868 (setq snippet
2869 (if expand-env
2870 (let ((read-vars (condition-case err
2871 (read expand-env)
2872 (error nil))))
2873 (eval `(let ,read-vars
2874 (yas/snippet-create (point-min) (point-max)))))
2875 (yas/snippet-create (point-min) (point-max))))))
2876
2877 ;; stacked-expansion: This checks for stacked expansion, save the
2878 ;; `yas/previous-active-field' and advance its boudary.
2879 ;;
2880 (let ((existing-field (and yas/active-field-overlay
2881 (overlay-buffer yas/active-field-overlay)
2882 (overlay-get yas/active-field-overlay 'yas/field))))
2883 (when existing-field
2884 (setf (yas/snippet-previous-active-field snippet) existing-field)
2885 (yas/advance-end-maybe existing-field (overlay-end yas/active-field-overlay))))
2886
2887 ;; Exit the snippet immediately if no fields
2888 ;;
2889 (unless (yas/snippet-fields snippet)
2890 (yas/exit-snippet snippet))
2891
2892 ;; Push two undo actions: the deletion of the inserted contents of
2893 ;; the new snippet (without the "key") followed by an apply of
2894 ;; `yas/take-care-of-redo' on the newly inserted snippet boundaries
2895 ;;
2896 (let ((start (overlay-start (yas/snippet-control-overlay snippet)))
2897 (end (overlay-end (yas/snippet-control-overlay snippet))))
2898 (push (cons start end) buffer-undo-list)
2899 (push `(apply yas/take-care-of-redo ,start ,end ,snippet)
2900 buffer-undo-list))
2901 ;; Now, move to the first field
2902 ;;
2903 (let ((first-field (car (yas/snippet-fields snippet))))
2904 (when first-field
2905 (yas/move-to-field snippet first-field))))
2906 (message "[yas] snippet expanded."))
2907
2908(defun yas/take-care-of-redo (beg end snippet)
2909 "Commits SNIPPET, which in turn pushes an undo action for
2910reviving it.
2911
2912Meant to exit in the `buffer-undo-list'."
2913 ;; slightly optimize: this action is only needed for snippets with
2914 ;; at least one field
2915 (when (yas/snippet-fields snippet)
2916 (yas/commit-snippet snippet 'no-hooks)))
2917
2918(defun yas/snippet-revive (beg end snippet)
2919 "Revives the SNIPPET and creates a control overlay from BEG to
2920END.
2921
2922BEG and END are, we hope, the original snippets boudaries. All
2923the markers/points exiting existing inside SNIPPET should point
2924to their correct locations *at the time the snippet is revived*.
2925
2926After revival, push the `yas/take-care-of-redo' in the
2927`buffer-undo-list'"
2928 ;; Reconvert all the points to markers
2929 ;;
2930 (yas/points-to-markers snippet)
2931 ;; When at least one editable field existed in the zombie snippet,
2932 ;; try to revive the whole thing...
2933 ;;
2934 (let ((target-field (or (yas/snippet-active-field snippet)
2935 (car (yas/snippet-fields snippet)))))
2936 (when target-field
2937 (setf (yas/snippet-control-overlay snippet) (yas/make-control-overlay snippet beg end))
2938 (overlay-put (yas/snippet-control-overlay snippet) 'yas/snippet snippet)
2939
2940 (yas/move-to-field snippet target-field)
2941
2942 (add-hook 'post-command-hook 'yas/post-command-handler nil t)
2943 (add-hook 'pre-command-hook 'yas/pre-command-handler t t)
2944
2945 (push `(apply yas/take-care-of-redo ,beg ,end ,snippet)
2946 buffer-undo-list))))
2947
2948(defun yas/snippet-create (begin end)
2949 "Creates a snippet from an template inserted between BEGIN and END.
2950
2951Returns the newly created snippet."
2952 (let ((snippet (yas/make-snippet)))
2953 (goto-char begin)
2954 (yas/snippet-parse-create snippet)
2955
2956 ;; Sort and link each field
2957 (yas/snippet-sort-fields snippet)
2958
2959 ;; Create keymap overlay for snippet
2960 (setf (yas/snippet-control-overlay snippet)
2961 (yas/make-control-overlay snippet (point-min) (point-max)))
2962
2963 ;; Move to end
2964 (goto-char (point-max))
2965
2966 ;; Setup hooks
2967 (add-hook 'post-command-hook 'yas/post-command-handler nil t)
2968 (add-hook 'pre-command-hook 'yas/pre-command-handler t t)
2969
2970 snippet))
2971
2972
2973;;; Apropos adjacencies: Once the $-constructs bits like "$n" and
2974;;; "${:n" are deleted in the recently expanded snippet, we might
2975;;; actually have many fields, mirrors (and the snippet exit) in the
2976;;; very same position in the buffer. Therefore we need to single-link
2977;;; the fields-or-mirrors-or-exit, which I have called "fom",
2978;;; according to their original positions in the buffer.
2979;;;
2980;;; Then we have operation `yas/advance-end-maybe' and
2981;;; `yas/advance-start-maybe', which conditionally push the starts and
2982;;; ends of these foms down the chain.
2983;;;
2984;;; This allows for like the printf with the magic ",":
2985;;;
2986;;; printf ("${1:%s}\\n"${1:$(if (string-match "%" text) "," "\);")} \
2987;;; $2${1:$(if (string-match "%" text) "\);" "")}$0
2988;;;
2989
2990(defun yas/fom-start (fom)
2991 (cond ((yas/field-p fom)
2992 (yas/field-start fom))
2993 ((yas/mirror-p fom)
2994 (yas/mirror-start fom))
2995 (t
2996 (yas/exit-marker fom))))
2997
2998(defun yas/fom-end (fom)
2999 (cond ((yas/field-p fom)
3000 (yas/field-end fom))
3001 ((yas/mirror-p fom)
3002 (yas/mirror-end fom))
3003 (t
3004 (yas/exit-marker fom))))
3005
3006(defun yas/fom-next (fom)
3007 (cond ((yas/field-p fom)
3008 (yas/field-next fom))
3009 ((yas/mirror-p fom)
3010 (yas/mirror-next fom))
3011 (t
3012 (yas/exit-next fom))))
3013
3014(defun yas/calculate-adjacencies (snippet)
3015 "Calculate adjacencies for fields or mirrors of SNIPPET.
3016
3017This is according to their relative positions in the buffer, and
3018has to be called before the $-constructs are deleted."
3019 (flet ((yas/fom-set-next-fom (fom nextfom)
3020 (cond ((yas/field-p fom)
3021 (setf (yas/field-next fom) nextfom))
3022 ((yas/mirror-p fom)
3023 (setf (yas/mirror-next fom) nextfom))
3024 (t
3025 (setf (yas/exit-next fom) nextfom))))
3026 (yas/compare-fom-begs (fom1 fom2)
3027 (> (yas/fom-start fom2) (yas/fom-start fom1)))
3028 (yas/link-foms (fom1 fom2)
3029 (yas/fom-set-next-fom fom1 fom2)))
3030 ;; make some yas/field, yas/mirror and yas/exit soup
3031 (let ((soup))
3032 (when (yas/snippet-exit snippet)
3033 (push (yas/snippet-exit snippet) soup))
3034 (dolist (field (yas/snippet-fields snippet))
3035 (push field soup)
3036 (dolist (mirror (yas/field-mirrors field))
3037 (push mirror soup)))
3038 (setq soup
3039 (sort soup
3040 #'yas/compare-fom-begs))
3041 (when soup
3042 (reduce #'yas/link-foms soup)))))
3043
3044(defun yas/advance-end-maybe (fom newend)
3045 "Maybe advance FOM's end to NEWEND if it needs it.
3046
3047If it does, also:
3048
3049* call `yas/advance-start-maybe' on FOM's next fom.
3050
3051* in case FOM is field call `yas/advance-end-maybe' on its parent
3052 field"
3053 (when (and fom (< (yas/fom-end fom) newend))
3054 (set-marker (yas/fom-end fom) newend)
3055 (yas/advance-start-maybe (yas/fom-next fom) newend)
3056 (if (and (yas/field-p fom)
3057 (yas/field-parent-field fom))
3058 (yas/advance-end-maybe (yas/field-parent-field fom) newend))))
3059
3060(defun yas/advance-start-maybe (fom newstart)
3061 "Maybe advance FOM's start to NEWSTART if it needs it.
3062
3063If it does, also call `yas/advance-end-maybe' on FOM."
3064 (when (and fom (< (yas/fom-start fom) newstart))
3065 (set-marker (yas/fom-start fom) newstart)
3066 (yas/advance-end-maybe fom newstart)))
3067
3068(defvar yas/dollar-regions nil
3069 "When expanding the snippet the \"parse-create\" functions add
3070 cons cells to this var")
3071
3072(defun yas/snippet-parse-create (snippet)
3073 "Parse a recently inserted snippet template, creating all
3074necessary fields, mirrors and exit points.
3075
3076Meant to be called in a narrowed buffer, does various passes"
3077 (let ((parse-start (point)))
3078 ;; Reset the yas/dollar-regions
3079 ;;
3080 (setq yas/dollar-regions nil)
3081 ;; protect escaped quote, backquotes and backslashes
3082 ;;
3083 (yas/protect-escapes nil '(?\\ ?` ?'))
3084 ;; replace all backquoted expressions
3085 ;;
3086 (goto-char parse-start)
3087 (yas/replace-backquotes)
3088 ;; protect escapes again since previous steps might have generated
3089 ;; more characters needing escaping
3090 ;;
3091 (goto-char parse-start)
3092 (yas/protect-escapes)
3093 ;; parse fields with {}
3094 ;;
3095 (goto-char parse-start)
3096 (yas/field-parse-create snippet)
3097 ;; parse simple mirrors and fields
3098 ;;
3099 (goto-char parse-start)
3100 (yas/simple-mirror-parse-create snippet)
3101 ;; parse mirror transforms
3102 ;;
3103 (goto-char parse-start)
3104 (yas/transform-mirror-parse-create snippet)
3105 ;; calculate adjacencies of fields and mirrors
3106 ;;
3107 (yas/calculate-adjacencies snippet)
3108 ;; Delete $-constructs
3109 ;;
3110 (yas/delete-regions yas/dollar-regions)
3111 ;; restore escapes
3112 ;;
3113 (goto-char parse-start)
3114 (yas/restore-escapes)
3115 ;; update mirrors for the first time
3116 ;;
3117 (yas/update-mirrors snippet)
3118 ;; indent the best we can
3119 ;;
3120 (goto-char parse-start)
3121 (yas/indent snippet)))
3122
3123(defun yas/indent-according-to-mode (snippet-markers)
3124 "Indent current line according to mode, preserving
3125SNIPPET-MARKERS."
3126 ;; XXX: Here seems to be the indent problem:
3127 ;;
3128 ;; `indent-according-to-mode' uses whatever
3129 ;; `indent-line-function' is available. Some
3130 ;; implementations of these functions delete text
3131 ;; before they insert. If there happens to be a marker
3132 ;; just after the text being deleted, the insertion
3133 ;; actually happens after the marker, which misplaces
3134 ;; it.
3135 ;;
3136 ;; This would also happen if we had used overlays with
3137 ;; the `front-advance' property set to nil.
3138 ;;
3139 ;; This is why I have these `trouble-markers', they are the ones at
3140 ;; they are the ones at the first non-whitespace char at the line
3141 ;; (i.e. at `yas/real-line-beginning'. After indentation takes place
3142 ;; we should be at the correct to restore them to. All other
3143 ;; non-trouble-markers have been *pushed* and don't need special
3144 ;; attention.
3145 ;;
3146 (goto-char (yas/real-line-beginning))
3147 (let ((trouble-markers (remove-if-not #'(lambda (marker)
3148 (= marker (point)))
3149 snippet-markers)))
3150 (save-restriction
3151 (widen)
3152 (condition-case err
3153 (indent-according-to-mode)
3154 (error (message "[yas] warning: yas/indent-according-to-mode habing problems running %s" indent-line-function)
3155 nil)))
3156 (mapc #'(lambda (marker)
3157 (set-marker marker (point)))
3158 trouble-markers)))
3159
3160(defun yas/indent (snippet)
3161 (let ((snippet-markers (yas/collect-snippet-markers snippet)))
3162 ;; Look for those $>
3163 (save-excursion
3164 (while (re-search-forward "$>" nil t)
3165 (delete-region (match-beginning 0) (match-end 0))
3166 (when (not (eq yas/indent-line 'auto))
3167 (yas/indent-according-to-mode snippet-markers))))
3168 ;; Now do stuff for 'fixed and 'auto
3169 (save-excursion
3170 (cond ((eq yas/indent-line 'fixed)
3171 (while (and (zerop (forward-line))
3172 (zerop (current-column)))
3173 (indent-to-column column)))
3174 ((eq yas/indent-line 'auto)
3175 (let ((end (set-marker (make-marker) (point-max)))
3176 (indent-first-line-p yas/also-auto-indent-first-line))
3177 (while (and (zerop (if indent-first-line-p
3178 (prog1
3179 (forward-line 0)
3180 (setq indent-first-line-p nil))
3181 (forward-line 1)))
3182 (not (eobp))
3183 (<= (point) end))
3184 (yas/indent-according-to-mode snippet-markers))))
3185 (t
3186 nil)))))
3187
3188(defun yas/collect-snippet-markers (snippet)
3189 "Make a list of all the markers used by SNIPPET."
3190 (let (markers)
3191 (dolist (field (yas/snippet-fields snippet))
3192 (push (yas/field-start field) markers)
3193 (push (yas/field-end field) markers)
3194 (dolist (mirror (yas/field-mirrors field))
3195 (push (yas/mirror-start mirror) markers)
3196 (push (yas/mirror-end mirror) markers)))
3197 (let ((snippet-exit (yas/snippet-exit snippet)))
3198 (when (and snippet-exit
3199 (marker-buffer (yas/exit-marker snippet-exit)))
3200 (push (yas/exit-marker snippet-exit) markers)))
3201 markers))
3202
3203(defun yas/real-line-beginning ()
3204 (let ((c (char-after (line-beginning-position)))
3205 (n (line-beginning-position)))
3206 (while (or (eql c ?\ )
3207 (eql c ?\t))
3208 (incf n)
3209 (setq c (char-after n)))
3210 n))
3211
3212(defun yas/escape-string (escaped)
3213 (concat "YASESCAPE" (format "%d" escaped) "PROTECTGUARD"))
3214
3215(defun yas/protect-escapes (&optional text escaped)
3216 "Protect all escaped characters with their numeric ASCII value.
3217
3218With optional string TEXT do it in string instead of buffer."
3219 (let ((changed-text text)
3220 (text-provided-p text))
3221 (mapc #'(lambda (escaped)
3222 (setq changed-text
3223 (yas/replace-all (concat "\\" (char-to-string escaped))
3224 (yas/escape-string escaped)
3225 (when text-provided-p changed-text))))
3226 (or escaped yas/escaped-characters))
3227 changed-text))
3228
3229(defun yas/restore-escapes (&optional text escaped)
3230 "Restore all escaped characters from their numeric ASCII value.
3231
3232With optional string TEXT do it in string instead of the buffer."
3233 (let ((changed-text text)
3234 (text-provided-p text))
3235 (mapc #'(lambda (escaped)
3236 (setq changed-text
3237 (yas/replace-all (yas/escape-string escaped)
3238 (char-to-string escaped)
3239 (when text-provided-p changed-text))))
3240 (or escaped yas/escaped-characters))
3241 changed-text))
3242
3243(defun yas/replace-backquotes ()
3244 "Replace all the \"`(lisp-expression)`\"-style expression
3245 with their evaluated value"
3246 (while (re-search-forward yas/backquote-lisp-expression-regexp nil t)
3247 (let ((transformed (yas/read-and-eval-string (yas/restore-escapes (match-string 1)))))
3248 (goto-char (match-end 0))
3249 (when transformed (insert transformed))
3250 (delete-region (match-beginning 0) (match-end 0)))))
3251
3252(defun yas/scan-sexps (from count)
3253 (condition-case err
3254 (with-syntax-table (standard-syntax-table)
3255 (scan-sexps from count))
3256 (error
3257 nil)))
3258
3259(defun yas/make-marker (pos)
3260 "Create a marker at POS with `nil' `marker-insertion-type'"
3261 (let ((marker (set-marker (make-marker) pos)))
3262 (set-marker-insertion-type marker nil)
3263 marker))
3264
3265(defun yas/field-parse-create (snippet &optional parent-field)
3266 "Parse most field expressions, except for the simple one \"$n\".
3267
3268The following count as a field:
3269
3270* \"${n: text}\", for a numbered field with default text, as long as N is not 0;
3271
3272* \"${n: text$(expression)}, the same with a lisp expression;
3273 this is caught with the curiously named `yas/multi-dollar-lisp-expression-regexp'
3274
3275* the same as above but unnumbered, (no N:) and number is calculated automatically.
3276
3277When multiple expressions are found, only the last one counts."
3278 ;;
3279 (save-excursion
3280 (while (re-search-forward yas/field-regexp nil t)
3281 (let* ((real-match-end-0 (yas/scan-sexps (1+ (match-beginning 0)) 1))
3282 (number (and (match-string-no-properties 1)
3283 (string-to-number (match-string-no-properties 1))))
3284 (brand-new-field (and real-match-end-0
3285 ;; break if on "$(" immediately
3286 ;; after the ":", this will be
3287 ;; caught as a mirror with
3288 ;; transform later.
3289 (not (save-match-data
3290 (eq (string-match "$[ \t\n]*("
3291 (match-string-no-properties 2)) 0)))
3292 (not (and number (zerop number)))
3293 (yas/make-field number
3294 (yas/make-marker (match-beginning 2))
3295 (yas/make-marker (1- real-match-end-0))
3296 parent-field))))
3297 (when brand-new-field
3298 (goto-char real-match-end-0)
3299 (push (cons (1- real-match-end-0) real-match-end-0)
3300 yas/dollar-regions)
3301 (push (cons (match-beginning 0) (match-beginning 2))
3302 yas/dollar-regions)
3303 (push brand-new-field (yas/snippet-fields snippet))
3304 (save-excursion
3305 (save-restriction
3306 (narrow-to-region (yas/field-start brand-new-field) (yas/field-end brand-new-field))
3307 (goto-char (point-min))
3308 (yas/field-parse-create snippet brand-new-field)))))))
3309 ;; if we entered from a parent field, now search for the
3310 ;; `yas/multi-dollar-lisp-expression-regexp'. THis is used for
3311 ;; primary field transformations
3312 ;;
3313 (when parent-field
3314 (save-excursion
3315 (while (re-search-forward yas/multi-dollar-lisp-expression-regexp nil t)
3316 (let* ((real-match-end-1 (yas/scan-sexps (match-beginning 1) 1)))
3317 ;; commit the primary field transformation if we don't find
3318 ;; it in yas/dollar-regions (a subnested field) might have
3319 ;; already caught it.
3320 (when (and real-match-end-1
3321 (not (member (cons (match-beginning 0)
3322 real-match-end-1)
3323 yas/dollar-regions)))
3324 (let ((lisp-expression-string (buffer-substring-no-properties (match-beginning 1)
3325 real-match-end-1)))
3326 (setf (yas/field-transform parent-field) (yas/restore-escapes lisp-expression-string)))
3327 (push (cons (match-beginning 0) real-match-end-1)
3328 yas/dollar-regions)))))))
3329
3330(defun yas/transform-mirror-parse-create (snippet)
3331 "Parse the \"${n:$(lisp-expression)}\" mirror transformations."
3332 (while (re-search-forward yas/transform-mirror-regexp nil t)
3333 (let* ((real-match-end-0 (yas/scan-sexps (1+ (match-beginning 0)) 1))
3334 (number (string-to-number (match-string-no-properties 1)))
3335 (field (and number
3336 (not (zerop number))
3337 (yas/snippet-find-field snippet number))))
3338 (when (and real-match-end-0
3339 field)
3340 (push (yas/make-mirror (yas/make-marker (match-beginning 0))
3341 (yas/make-marker (match-beginning 0))
3342 (yas/restore-escapes
3343 (buffer-substring-no-properties (match-beginning 2)
3344 (1- real-match-end-0))))
3345 (yas/field-mirrors field))
3346 (push (cons (match-beginning 0) real-match-end-0) yas/dollar-regions)))))
3347
3348(defun yas/simple-mirror-parse-create (snippet)
3349 "Parse the simple \"$n\" mirrors and the exit-marker."
3350 (while (re-search-forward yas/simple-mirror-regexp nil t)
3351 (let ((number (string-to-number (match-string-no-properties 1))))
3352 (cond ((zerop number)
3353
3354 (setf (yas/snippet-exit snippet)
3355 (yas/make-exit (yas/make-marker (match-end 0))))
3356 (save-excursion
3357 (goto-char (match-beginning 0))
3358 (when yas/wrap-around-region
3359 (cond (yas/selected-text
3360 (insert yas/selected-text))
3361 ((and (eq yas/wrap-around-region 'cua)
3362 cua-mode
3363 (get-register ?0))
3364 (insert (prog1 (get-register ?0)
3365 (set-register ?0 nil))))))
3366 (push (cons (point) (yas/exit-marker (yas/snippet-exit snippet)))
3367 yas/dollar-regions)))
3368 (t
3369 (let ((field (yas/snippet-find-field snippet number)))
3370 (if field
3371 (push (yas/make-mirror (yas/make-marker (match-beginning 0))
3372 (yas/make-marker (match-beginning 0))
3373 nil)
3374 (yas/field-mirrors field))
3375 (push (yas/make-field number
3376 (yas/make-marker (match-beginning 0))
3377 (yas/make-marker (match-beginning 0))
3378 nil)
3379 (yas/snippet-fields snippet))))
3380 (push (cons (match-beginning 0) (match-end 0))
3381 yas/dollar-regions))))))
3382
3383(defun yas/delete-regions (regions)
3384 "Sort disjuct REGIONS by start point, then delete from the back."
3385 (mapc #'(lambda (reg)
3386 (delete-region (car reg) (cdr reg)))
3387 (sort regions
3388 #'(lambda (r1 r2)
3389 (>= (car r1) (car r2))))))
3390
3391(defun yas/update-mirrors (snippet)
3392 "Updates all the mirrors of SNIPPET."
3393 (save-excursion
3394 (dolist (field (yas/snippet-fields snippet))
3395 (dolist (mirror (yas/field-mirrors field))
3396 ;; stacked expansion: I added an `inhibit-modification-hooks'
3397 ;; here, for safety, may need to remove if we the mechanism is
3398 ;; altered.
3399 ;;
3400 (let ((inhibit-modification-hooks t))
3401 (yas/mirror-update-display mirror field)
3402 ;; `yas/place-overlays' is needed if the active field and
3403 ;; protected overlays have been changed because of insertions
3404 ;; in `yas/mirror-update-display'
3405 ;;
3406 (when (eq field (yas/snippet-active-field snippet))
3407 (yas/place-overlays snippet field)))))))
3408
3409(defun yas/mirror-update-display (mirror field)
3410 "Update MIRROR according to FIELD (and mirror transform)."
3411 (let ((reflection (or (yas/apply-transform mirror field)
3412 (yas/field-text-for-display field))))
3413 (when (and reflection
3414 (not (string= reflection (buffer-substring-no-properties (yas/mirror-start mirror)
3415 (yas/mirror-end mirror)))))
3416 (goto-char (yas/mirror-start mirror))
3417 (insert reflection)
3418 (if (> (yas/mirror-end mirror) (point))
3419 (delete-region (point) (yas/mirror-end mirror))
3420 (set-marker (yas/mirror-end mirror) (point))
3421 (yas/advance-start-maybe (yas/mirror-next mirror) (point))))))
3422
3423(defun yas/field-update-display (field snippet)
3424 "Much like `yas/mirror-update-display', but for fields"
3425 (when (yas/field-transform field)
3426 (let ((inhibit-modification-hooks t)
3427 (transformed (yas/apply-transform field field))
3428 (point (point)))
3429 (when (and transformed
3430 (not (string= transformed (buffer-substring-no-properties (yas/field-start field)
3431 (yas/field-end field)))))
3432 (setf (yas/field-modified-p field) t)
3433 (goto-char (yas/field-start field))
3434 (insert transformed)
3435 (if (> (yas/field-end field) (point))
3436 (delete-region (point) (yas/field-end field))
3437 (set-marker (yas/field-end field) (point))
3438 (yas/advance-start-maybe (yas/field-next field) (point)))
3439 t))))
3440
3441
3442;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3443;; Pre- and post-command hooks
3444;;
3445(defun yas/pre-command-handler () )
3446
3447(defun yas/post-command-handler ()
3448 "Handles various yasnippet conditions after each command."
3449 (cond (yas/protection-violation
3450 (goto-char yas/protection-violation)
3451 (setq yas/protection-violation nil))
3452 ((eq 'undo this-command)
3453 ;;
3454 ;; After undo revival the correct field is sometimes not
3455 ;; restored correctly, this condition handles that
3456 ;;
3457 (let* ((snippet (car (yas/snippets-at-point)))
3458 (target-field (and snippet
3459 (find-if-not #'(lambda (field)
3460 (yas/field-probably-deleted-p snippet field))
3461 (remove nil
3462 (cons (yas/snippet-active-field snippet)
3463 (yas/snippet-fields snippet)))))))
3464 (when target-field
3465 (yas/move-to-field snippet target-field))))
3466 ((not (yas/undo-in-progress))
3467 ;; When not in an undo, check if we must commit the snippet (use exited it).
3468 (yas/check-commit-snippet))))
3469
3470;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3471;; Debug functions. Use (or change) at will whenever needed.
3472;;
3473;; some useful debug code for looking up snippet tables
3474;;
3475;; (insert (pp
3476;; (let ((shit))
3477;; (maphash #'(lambda (k v)
3478;; (push k shit))
3479;; (yas/snippet-table-hash (gethash 'ruby-mode yas/snippet-tables)))
3480;; shit)))
3481;;
3482
3483(defun yas/debug-tables ()
3484 (interactive)
3485 (with-output-to-temp-buffer "*YASnippet tables*"
3486 (dolist (symbol (remove nil (append (list major-mode)
3487 (if (listp yas/mode-symbol)
3488 yas/mode-symbol
3489 (list yas/mode-symbol)))))
3490 (princ (format "Snippet table hash keys for %s:\n\n" symbol))
3491 (let ((keys))
3492 (maphash #'(lambda (k v)
3493 (push k keys))
3494 (yas/snippet-table-hash (gethash symbol yas/snippet-tables)))
3495 (princ keys))
3496
3497 (princ (format "Keymap for %s:\n\n" symbol))
3498 (princ (gethash symbol yas/menu-table)))))
3499
3500(defun yas/debug-snippet-vars ()
3501 "Debug snippets, fields, mirrors and the `buffer-undo-list'."
3502 (interactive)
3503 (with-output-to-temp-buffer "*YASnippet trace*"
3504 (princ "Interesting YASnippet vars: \n\n")
3505
3506 (princ (format "\nPost command hook: %s\n" post-command-hook))
3507 (princ (format "\nPre command hook: %s\n" pre-command-hook))
3508
3509 (princ (format "%s live snippets in total\n" (length (yas/snippets-at-point (quote all-snippets)))))
3510 (princ (format "%s overlays in buffer:\n\n" (length (overlays-in (point-min) (point-max)))))
3511 (princ (format "%s live snippets at point:\n\n" (length (yas/snippets-at-point))))
3512
3513
3514 (dolist (snippet (yas/snippets-at-point))
3515 (princ (format "\tsid: %d control overlay from %d to %d\n"
3516 (yas/snippet-id snippet)
3517 (overlay-start (yas/snippet-control-overlay snippet))
3518 (overlay-end (yas/snippet-control-overlay snippet))))
3519 (princ (format "\tactive field: %d from %s to %s covering \"%s\"\n"
3520 (yas/field-number (yas/snippet-active-field snippet))
3521 (marker-position (yas/field-start (yas/snippet-active-field snippet)))
3522 (marker-position (yas/field-end (yas/snippet-active-field snippet)))
3523 (buffer-substring-no-properties (yas/field-start (yas/snippet-active-field snippet)) (yas/field-end (yas/snippet-active-field snippet)))))
3524 (when (yas/snippet-exit snippet)
3525 (princ (format "\tsnippet-exit: at %s next: %s\n"
3526 (yas/exit-marker (yas/snippet-exit snippet))
3527 (yas/exit-next (yas/snippet-exit snippet)))))
3528 (dolist (field (yas/snippet-fields snippet))
3529 (princ (format "\tfield: %d from %s to %s covering \"%s\" next: %s\n"
3530 (yas/field-number field)
3531 (marker-position (yas/field-start field))
3532 (marker-position (yas/field-end field))
3533 (buffer-substring-no-properties (yas/field-start field) (yas/field-end field))
3534 (yas/debug-format-fom-concise (yas/field-next field))))
3535 (dolist (mirror (yas/field-mirrors field))
3536 (princ (format "\t\tmirror: from %s to %s covering \"%s\" next: %s\n"
3537 (marker-position (yas/mirror-start mirror))
3538 (marker-position (yas/mirror-end mirror))
3539 (buffer-substring-no-properties (yas/mirror-start mirror) (yas/mirror-end mirror))
3540 (yas/debug-format-fom-concise (yas/mirror-next mirror)))))))
3541
3542 (princ (format "\nUndo is %s and point-max is %s.\n"
3543 (if (eq buffer-undo-list t)
3544 "DISABLED"
3545 "ENABLED")
3546 (point-max)))
3547 (unless (eq buffer-undo-list t)
3548 (princ (format "Undpolist has %s elements. First 10 elements follow:\n" (length buffer-undo-list)))
3549 (let ((first-ten (subseq buffer-undo-list 0 19)))
3550 (dolist (undo-elem first-ten)
3551 (princ (format "%2s: %s\n" (position undo-elem first-ten) (truncate-string-to-width (format "%s" undo-elem) 70))))))))
3552
3553(defun yas/debug-format-fom-concise (fom)
3554 (when fom
3555 (cond ((yas/field-p fom)
3556 (format "field %d from %d to %d"
3557 (yas/field-number fom)
3558 (marker-position (yas/field-start fom))
3559 (marker-position (yas/field-end fom))))
3560 ((yas/mirror-p fom)
3561 (format "mirror from %d to %d"
3562 (marker-position (yas/mirror-start fom))
3563 (marker-position (yas/mirror-end fom))))
3564 (t
3565 (format "snippet exit at %d"
3566 (marker-position (yas/fom-start fom)))))))
3567
3568
3569(defun yas/exterminate-package ()
3570 (interactive)
3571 (yas/global-mode -1)
3572 (yas/minor-mode -1)
3573 (yas/kill-snippet-keybindings)
3574 (mapatoms #'(lambda (atom)
3575 (when (string-match "yas/" (symbol-name atom))
3576 (unintern atom)))))
3577
3578(defun yas/debug-test (&optional quiet)
3579 (interactive "P")
3580 (yas/load-directory (or (and (listp yas/root-directory)
3581 (first yas/root-directory))
3582 yas/root-directory
3583 "~/Source/yasnippet/snippets/"))
3584 (set-buffer (switch-to-buffer "*YAS TEST*"))
3585 (mapc #'yas/commit-snippet (yas/snippets-at-point 'all-snippets))
3586 (erase-buffer)
3587 (setq buffer-undo-list nil)
3588 (setq undo-in-progress nil)
3589 (snippet-mode)
3590 (yas/minor-mode 1)
3591 (let ((abbrev))
3592 (setq abbrev "$f")
3593 (insert abbrev))
3594 (unless quiet
3595 (add-hook 'post-command-hook 'yas/debug-snippet-vars 't 'local)))
3596
3597
3598;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3599;;; `locate-dominating-file' is added for compatibility in emacs < 23
3600(unless (or (eq emacs-major-version 23)
3601 (fboundp 'locate-dominating-file))
3602 (defvar locate-dominating-stop-dir-regexp
3603 "\\`\\(?:[\\/][\\/][^\\/]+[\\/]\\|/\\(?:net\\|afs\\|\\.\\.\\.\\)/\\)\\'"
3604 "Regexp of directory names which stop the search in `locate-dominating-file'.
3605Any directory whose name matches this regexp will be treated like
3606a kind of root directory by `locate-dominating-file' which will stop its search
3607when it bumps into it.
3608The default regexp prevents fruitless and time-consuming attempts to find
3609special files in directories in which filenames are interpreted as hostnames,
3610or mount points potentially requiring authentication as a different user.")
3611
3612 (defun locate-dominating-file (file name)
3613 "Look up the directory hierarchy from FILE for a file named NAME.
3614Stop at the first parent directory containing a file NAME,
3615and return the directory. Return nil if not found."
3616 ;; We used to use the above locate-dominating-files code, but the
3617 ;; directory-files call is very costly, so we're much better off doing
3618 ;; multiple calls using the code in here.
3619 ;;
3620 ;; Represent /home/luser/foo as ~/foo so that we don't try to look for
3621 ;; `name' in /home or in /.
3622 (setq file (abbreviate-file-name file))
3623 (let ((root nil)
3624 (prev-file file)
3625 ;; `user' is not initialized outside the loop because
3626 ;; `file' may not exist, so we may have to walk up part of the
3627 ;; hierarchy before we find the "initial UID".
3628 (user nil)
3629 try)
3630 (while (not (or root
3631 (null file)
3632 ;; FIXME: Disabled this heuristic because it is sometimes
3633 ;; inappropriate.
3634 ;; As a heuristic, we stop looking up the hierarchy of
3635 ;; directories as soon as we find a directory belonging
3636 ;; to another user. This should save us from looking in
3637 ;; things like /net and /afs. This assumes that all the
3638 ;; files inside a project belong to the same user.
3639 ;; (let ((prev-user user))
3640 ;; (setq user (nth 2 (file-attributes file)))
3641 ;; (and prev-user (not (equal user prev-user))))
3642 (string-match locate-dominating-stop-dir-regexp file)))
3643 (setq try (file-exists-p (expand-file-name name file)))
3644 (cond (try (setq root file))
3645 ((equal file (setq prev-file file
3646 file (file-name-directory
3647 (directory-file-name file))))
3648 (setq file nil))))
3649 root)))
3650
3651(provide 'yasnippet)
3652
3653;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3654;; Monkey patching for other functions that's causing
3655;; problems to yasnippet. For details on why I patch
3656;; those functions, refer to
3657;; http://code.google.com/p/yasnippet/wiki/MonkeyPatching
3658;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3659(defadvice c-neutralize-syntax-in-CPP
3660 (around yas-mp/c-neutralize-syntax-in-CPP activate)
3661 "Adviced `c-neutralize-syntax-in-CPP' to properly
3662handle the end-of-buffer error fired in it by calling
3663`forward-char' at the end of buffer."
3664 (condition-case err
3665 ad-do-it
3666 (error (message (error-message-string err)))))
3667
3668;; disable c-electric-* serial command in YAS fields
3669(add-hook 'c-mode-common-hook
3670 '(lambda ()
3671 (dolist (k '(":" ">" ";" "<" "{" "}"))
3672 (define-key (symbol-value (make-local-variable 'yas/keymap))
3673 k 'self-insert-command))))
3674
3675
3676;;; yasnippet.el ends here
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/beginend b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/beginend
new file mode 100644
index 0000000..68303e2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/beginend
@@ -0,0 +1,3 @@
1#name : v.begin(), v.end()
2# --
3${1:v}.begin(), $1.end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/class b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/class
new file mode 100644
index 0000000..820fc6c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/class
@@ -0,0 +1,8 @@
1#name : class ... { ... }
2# --
3class ${1:Name}
4{
5public:
6 ${1:$(yas/substr text "[^: ]*")}($2);
7 virtual ~${1:$(yas/substr text "[^: ]*")}();
8}; \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/ns b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/ns
new file mode 100644
index 0000000..0c2513f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/ns
@@ -0,0 +1,3 @@
1#name : namespace ...
2# --
3namespace \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/template b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/template
new file mode 100644
index 0000000..7e50616
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/template
@@ -0,0 +1,3 @@
1#name : template <typename ...>
2# --
3template <typename ${T}> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/using b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/using
new file mode 100644
index 0000000..13d0f5d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/c++-mode/using
@@ -0,0 +1,4 @@
1#name : using namespace ...
2# --
3using namespace ${std};
4$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/c-mode/fopen b/.emacs.d/mysnippets/text-mode/cc-mode/c-mode/fopen
new file mode 100644
index 0000000..044c743
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/c-mode/fopen
@@ -0,0 +1,3 @@
1#name : FILE *fp = fopen(..., ...);
2# --
3FILE *${fp} = fopen(${"file"}, "${r}");
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/c-mode/printf b/.emacs.d/mysnippets/text-mode/cc-mode/c-mode/printf
new file mode 100644
index 0000000..055461d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/c-mode/printf
@@ -0,0 +1,6 @@
1# -*- mode: snippet -*-
2# name : printf
3# contributor : joaotavora
4# --
5printf ("${1:%s}\\n"${1:$(if (string-match "%" text) "," "\);")
6}$2${1:$(if (string-match "%" text) "\);" "")} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib
new file mode 100644
index 0000000..9e14e22
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib
@@ -0,0 +1,7 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : private attribute ....;
3# --
4/// <summary>
5/// $3
6/// </summary>
7private $1 $2;
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.1 b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.1
new file mode 100644
index 0000000..099cc7b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.1
@@ -0,0 +1,21 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : private attribute ....; public property ... ... { ... }
3# --
4/// <summary>
5/// $3
6/// </summary>
7private $1 $2;
8
9/// <summary>
10/// $4
11/// </summary>
12/// <value>$5</value>
13public $1 $2
14{
15 get {
16 return this.$2;
17 }
18 set {
19 this.$2 = value;
20 }
21}
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.2 b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.2
new file mode 100644
index 0000000..566eacf
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.2
@@ -0,0 +1,21 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : private _attribute ....; public Property ... ... { ... }
3# --
4/// <summary>
5/// $3
6/// </summary>
7private $1 ${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")};
8
9/// <summary>
10/// ${3:Description}
11/// </summary>
12/// <value><c>$1</c></value>
13public ${1:Type} ${2:Name}
14{
15 get {
16 return this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")};
17 }
18 set {
19 this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")} = value;
20 }
21}
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/class b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/class
new file mode 100644
index 0000000..1cce2e8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/class
@@ -0,0 +1,21 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : class ... { ... }
3# --
4${5:public} class ${1:Name}
5{
6 #region Ctor & Destructor
7 /// <summary>
8 /// ${3:Standard Constructor}
9 /// </summary>
10 public $1($2)
11 {
12 }
13
14 /// <summary>
15 /// ${4:Default Destructor}
16 /// </summary>
17 public ~$1()
18 {
19 }
20 #endregion
21}
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment
new file mode 100644
index 0000000..3bd20d3
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment
@@ -0,0 +1,6 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : /// <summary> ... </summary>
3# --
4/// <summary>
5/// $1
6/// </summary>
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.1 b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.1
new file mode 100644
index 0000000..3c14ad9
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.1
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : /// <param name="..."> ... </param>
3# --
4/// <param name="$1">$2</param>
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.2 b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.2
new file mode 100644
index 0000000..63a6a20
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.2
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : /// <param name="..."> ... </param>
3# --
4/// <returns>$1</returns>
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.3 b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.3
new file mode 100644
index 0000000..394c323
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.3
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : /// <exception cref="..."> ... </exception>
3# --
4/// <exception cref="$1">$2</exception>
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/method b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/method
new file mode 100644
index 0000000..e9a5906
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/method
@@ -0,0 +1,10 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : public void Method { ... }
3# --
4/// <summary>
5/// ${5:Description}
6/// </summary>${2:$(if (string= (upcase text) "VOID") "" (format "%s%s%s" "\n/// <returns><c>" text "</c></returns>"))}
7${1:public} ${2:void} ${3:MethodName}($4)
8{
9$0
10}
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/namespace b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/namespace
new file mode 100644
index 0000000..af7c928
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/namespace
@@ -0,0 +1,7 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : namespace .. { ... }
3# --
4namespace $1
5{
6$0
7}
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/prop b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/prop
new file mode 100644
index 0000000..df9df91
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/prop
@@ -0,0 +1,16 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : property ... ... { ... }
3# --
4/// <summary>
5/// $5
6/// </summary>
7/// <value>$6</value>
8$1 $2 $3
9{
10 get {
11 return this.$4;
12 }
13 set {
14 this.$4 = value;
15 }
16}
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/region b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/region
new file mode 100644
index 0000000..83f9a24
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/region
@@ -0,0 +1,6 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : #region ... #endregion
3# --
4#region $1
5$0
6#endregion
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using
new file mode 100644
index 0000000..704637e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : using ...;
3# --
4using $1;
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.1 b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.1
new file mode 100644
index 0000000..e9f0bb0
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.1
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : using System;
3# --
4using System;
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.2 b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.2
new file mode 100644
index 0000000..0a3c07d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.2
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : using System....;
3# --
4using System.$1;
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/do b/.emacs.d/mysnippets/text-mode/cc-mode/do
new file mode 100644
index 0000000..5f7a313
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/do
@@ -0,0 +1,6 @@
1#name : do { ... } while (...)
2# --
3do
4{
5 $0
6} while (${1:condition}); \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/for b/.emacs.d/mysnippets/text-mode/cc-mode/for
new file mode 100644
index 0000000..c4cade6
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/for
@@ -0,0 +1,6 @@
1#name : for (...; ...; ...) { ... }
2# --
3for (${1:int i = 0}; ${2:i < N}; ${3:++i})
4{
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/if b/.emacs.d/mysnippets/text-mode/cc-mode/if
new file mode 100644
index 0000000..c3fe10d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/if
@@ -0,0 +1,6 @@
1#name : if (...) { ... }
2# --
3if (${1:condition})
4{
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/inc b/.emacs.d/mysnippets/text-mode/cc-mode/inc
new file mode 100644
index 0000000..ae33328
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/inc
@@ -0,0 +1,3 @@
1#name : #include "..."
2# --
3#include "$1"
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/inc.1 b/.emacs.d/mysnippets/text-mode/cc-mode/inc.1
new file mode 100644
index 0000000..66326cd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/inc.1
@@ -0,0 +1,3 @@
1#name : #include <...>
2# --
3#include <$1>
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/main b/.emacs.d/mysnippets/text-mode/cc-mode/main
new file mode 100644
index 0000000..9249049
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/main
@@ -0,0 +1,7 @@
1#name: int main(argc, argv) { ... }
2# --
3int main(int argc, char *argv[])
4{
5 $0
6 return 0;
7}
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/objc-mode/prop b/.emacs.d/mysnippets/text-mode/cc-mode/objc-mode/prop
new file mode 100644
index 0000000..4d585db
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/objc-mode/prop
@@ -0,0 +1,13 @@
1#name : foo { ... } ; setFoo { ... }
2# --
3- (${1:id})${2:foo}
4{
5 return $2;
6}
7
8- (void)set${2:$(capitalize text)}:($1)aValue
9{
10 [$2 autorelease];
11 $2 = [aValue retain];
12}
13$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/once b/.emacs.d/mysnippets/text-mode/cc-mode/once
new file mode 100644
index 0000000..1b63c39
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/once
@@ -0,0 +1,8 @@
1#name : #ifndef XXX; #define XXX; #endif
2# --
3#ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_}
4#define $1
5
6$0
7
8#endif /* $1 */ \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/cc-mode/struct b/.emacs.d/mysnippets/text-mode/cc-mode/struct
new file mode 100644
index 0000000..f50dabf
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/cc-mode/struct
@@ -0,0 +1,6 @@
1#name : struct ... { ... }
2# --
3struct ${1:name}
4{
5 $0
6}; \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/bg b/.emacs.d/mysnippets/text-mode/css-mode/bg
new file mode 100644
index 0000000..d731807
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/bg
@@ -0,0 +1,3 @@
1#name : background-color: ...
2# --
3background-color: #${1:DDD}; \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/bg.1 b/.emacs.d/mysnippets/text-mode/css-mode/bg.1
new file mode 100644
index 0000000..d31f540
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/bg.1
@@ -0,0 +1,3 @@
1#name : background-image: ...
2# --
3background-image: url($1); \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/bor b/.emacs.d/mysnippets/text-mode/css-mode/bor
new file mode 100644
index 0000000..eb3a2b4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/bor
@@ -0,0 +1,3 @@
1#name : border size style color
2# --
3border: ${1:1px} ${2:solid} #${3:999}; \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/cl b/.emacs.d/mysnippets/text-mode/css-mode/cl
new file mode 100644
index 0000000..4fc7a8d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/cl
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : clear: ...
3# --
4clear: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/disp.block b/.emacs.d/mysnippets/text-mode/css-mode/disp.block
new file mode 100644
index 0000000..f74ea3c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/disp.block
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : display: block
3# --
4display: block;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/disp.inline b/.emacs.d/mysnippets/text-mode/css-mode/disp.inline
new file mode 100644
index 0000000..30275a8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/disp.inline
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : display: inline
3# --
4display: inline;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/disp.none b/.emacs.d/mysnippets/text-mode/css-mode/disp.none
new file mode 100644
index 0000000..80632a5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/disp.none
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : display: none
3# --
4display: none;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/ff b/.emacs.d/mysnippets/text-mode/css-mode/ff
new file mode 100644
index 0000000..a7352cf
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/ff
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : font-family: ...
3# --
4font-family: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/fs b/.emacs.d/mysnippets/text-mode/css-mode/fs
new file mode 100644
index 0000000..c28cdbb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/fs
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : font-size: ...
3# --
4font-size: ${12px};
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/mar.bottom b/.emacs.d/mysnippets/text-mode/css-mode/mar.bottom
new file mode 100644
index 0000000..9672f60
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/mar.bottom
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : margin-bottom: ...
3# --
4margin-bottom: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/mar.left b/.emacs.d/mysnippets/text-mode/css-mode/mar.left
new file mode 100644
index 0000000..414353e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/mar.left
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : margin-left: ...
3# --
4margin-left: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/mar.mar b/.emacs.d/mysnippets/text-mode/css-mode/mar.mar
new file mode 100644
index 0000000..13354db
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/mar.mar
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : margin: ...
3# --
4margin: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/mar.margin b/.emacs.d/mysnippets/text-mode/css-mode/mar.margin
new file mode 100644
index 0000000..97de70c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/mar.margin
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : margin top right bottom left
3# --
4margin: ${top} ${right} ${bottom} ${left};
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/mar.right b/.emacs.d/mysnippets/text-mode/css-mode/mar.right
new file mode 100644
index 0000000..47a4973
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/mar.right
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : margin-right: ...
3# --
4margin-right: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/mar.top b/.emacs.d/mysnippets/text-mode/css-mode/mar.top
new file mode 100644
index 0000000..c805754
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/mar.top
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : margin-top: ...
3# --
4margin-top: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/pad.bottom b/.emacs.d/mysnippets/text-mode/css-mode/pad.bottom
new file mode 100644
index 0000000..3b9495e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/pad.bottom
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : padding-bottom: ...
3# --
4padding-bottom: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/pad.left b/.emacs.d/mysnippets/text-mode/css-mode/pad.left
new file mode 100644
index 0000000..ecae515
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/pad.left
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : padding-left: ...
3# --
4padding-left: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/pad.pad b/.emacs.d/mysnippets/text-mode/css-mode/pad.pad
new file mode 100644
index 0000000..ee3a682
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/pad.pad
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : padding: ...
3# --
4padding: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/pad.padding b/.emacs.d/mysnippets/text-mode/css-mode/pad.padding
new file mode 100644
index 0000000..c1009d3
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/pad.padding
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : padding: top right bottom left
3# --
4padding: ${top} ${right} ${bottom} ${left};
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/pad.right b/.emacs.d/mysnippets/text-mode/css-mode/pad.right
new file mode 100644
index 0000000..98a9e12
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/pad.right
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : padding-right: ...
3# --
4padding-right: $1;
diff --git a/.emacs.d/mysnippets/text-mode/css-mode/pad.top b/.emacs.d/mysnippets/text-mode/css-mode/pad.top
new file mode 100644
index 0000000..34987f6
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/css-mode/pad.top
@@ -0,0 +1,4 @@
1#contributor : rejeep <johan.rejeep@gmail.com>
2#name : padding-top: ...
3# --
4padding-top: $1;
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/.read_me b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/.read_me
new file mode 100644
index 0000000..9e6e532
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/.read_me
@@ -0,0 +1,11 @@
1TITLE: Emacs Idiom Template Set. Version 1. 2009-02-22
2
3DESCRIPTION: Some useful templates for emacs lisp. This template set is based on useful elisp idioms on common tasks.
4
5LICENSING: GPL version 3.
6
7AUTHOR: Xah Lee
8
9Home Page: latest version at:
10• Emacs Lisp Idiom Templates
11 http://xahlee.org/emacs/elisp_idiom_templates.html
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/defun b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/defun
new file mode 100644
index 0000000..0105d20
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/defun
@@ -0,0 +1,11 @@
1#name : function template
2#contributor : Xah Lee
3# --
4(defun $1 ()
5 "thisandthat."
6 (interactive)
7 (let (var1)
8 (setq var1 some)
9 $0
10 )
11) \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/dired.process_marked b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/dired.process_marked
new file mode 100644
index 0000000..1b42597
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/dired.process_marked
@@ -0,0 +1,16 @@
1#name : process marked files in dired
2#contributor : Xah Lee
3# --
4;; idiom for processing a list of files in dired's marked files
5
6;; suppose myProcessFile is your function that takes a file path
7;; and do some processing on the file
8
9(defun dired-myProcessFile ()
10 "apply myProcessFile function to marked files in dired."
11 (interactive)
12 (require 'dired)
13 (mapc 'myProcessFile (dired-get-marked-files))
14)
15
16;; to use it, type M-x dired-myProcessFile
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.process b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.process
new file mode 100644
index 0000000..abd1a33
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.process
@@ -0,0 +1,17 @@
1#name : a function that process a file
2#contributor : Xah Lee
3# --
4(defun doThisFile (fpath)
5 "Process the file at path FPATH ..."
6 (let ()
7 ;; create temp buffer without undo record or font lock. (more efficient)
8 ;; first space in temp buff name is necessary
9 (set-buffer (get-buffer-create " myTemp"))
10 (insert-file-contents fpath nil nil nil t)
11
12 ;; process it ...
13 ;; (goto-char 0) ; move to begining of file's content (in case it was open)
14 ;; ... do something here
15 ;; (write-file fpath) ;; write back to the file
16
17 (kill-buffer " myTemp")))
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.read-lines b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.read-lines
new file mode 100644
index 0000000..b4a1942
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.read-lines
@@ -0,0 +1,17 @@
1#name : read lines of a file
2#contributor : Xah Lee
3# --
4(defun read-lines (filePath)
5 "Return a list of lines in FILEPATH."
6 (with-temp-buffer
7 (insert-file-contents filePath)
8 (split-string
9 (buffer-string) "\n" t)) )
10
11;; process all lines
12(mapc
13 (lambda (aLine)
14 (message aLine) ; do your stuff here
15 )
16 (read-lines "inputFilePath")
17) \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace
new file mode 100644
index 0000000..cefcf51
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace
@@ -0,0 +1,17 @@
1#name : find and replace on region
2#contributor : Xah Lee
3# --
4(defun replace-html-chars-region (start end)
5 "Replace “<” to “&lt;” and other chars in HTML.
6This works on the current region."
7 (interactive "r")
8 (save-restriction
9 (narrow-to-region start end)
10 (goto-char (point-min))
11 (while (search-forward "&" nil t) (replace-match "&amp;" nil t))
12 (goto-char (point-min))
13 (while (search-forward "<" nil t) (replace-match "&lt;" nil t))
14 (goto-char (point-min))
15 (while (search-forward ">" nil t) (replace-match "&gt;" nil t))
16 )
17 )
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabstring b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabstring
new file mode 100644
index 0000000..55600b1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabstring
@@ -0,0 +1,4 @@
1#name : grab buffer substring
2#contributor : Xah Lee
3# --
4(setq $0 (buffer-substring-no-properties myStartPos myEndPos))
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabthing b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabthing
new file mode 100644
index 0000000..772b8dc
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabthing
@@ -0,0 +1,4 @@
1#name : grab word under cursor
2#contributor : Xah Lee
3# --
4(setq $0 (thing-at-point 'symbol))
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/traverse_dir b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/traverse_dir
new file mode 100644
index 0000000..2859cbd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/traverse_dir
@@ -0,0 +1,6 @@
1#name : traversing a directory
2#contributor : Xah Lee
3# --
4;; apply a function to all files in a dir
5(require 'find-lisp)
6(mapc 'my-process-file (find-lisp-find-files "~/myweb/" "\\.html$"))
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region
new file mode 100644
index 0000000..66a59e4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region
@@ -0,0 +1,27 @@
1#name : Command that works on region or word
2#contributor : Xah Lee
3# --
4;; example of a command that works on current word or text selection
5(defun down-case-word-or-region ()
6 "Lower case the current word or text selection."
7(interactive)
8(let (pos1 pos2 meat)
9 (if (and transient-mark-mode mark-active)
10 (setq pos1 (region-beginning)
11 pos2 (region-end))
12 (setq pos1 (car (bounds-of-thing-at-point 'symbol))
13 pos2 (cdr (bounds-of-thing-at-point 'symbol))))
14
15 ; now, pos1 and pos2 are the starting and ending positions
16 ; of the current word, or current text selection if exists
17
18 ;; put your code here.
19 $0
20 ;; Some example of things you might want to do
21 (downcase-region pos1 pos2) ; example of a func that takes region as args
22 (setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text.
23 (delete-region pos1 pos2) ; get rid of it
24 (insert "newText") ; insert your new text
25
26 )
27)
diff --git a/.emacs.d/mysnippets/text-mode/email b/.emacs.d/mysnippets/text-mode/email
new file mode 100644
index 0000000..1ac7f94
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/email
@@ -0,0 +1,3 @@
1#name : (user's email)
2# --
3`(replace-regexp-in-string "@" "@NOSPAM." user-mail-address)` \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/after b/.emacs.d/mysnippets/text-mode/erlang-mode/after
new file mode 100644
index 0000000..264e201
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/after
@@ -0,0 +1,4 @@
1#name : after ... ->
2# --
3after
4 $1 -> $0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/begin b/.emacs.d/mysnippets/text-mode/erlang-mode/begin
new file mode 100644
index 0000000..7b48494
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/begin
@@ -0,0 +1,5 @@
1#name : begin ... end
2# --
3begin
4 $0
5end
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/beh b/.emacs.d/mysnippets/text-mode/erlang-mode/beh
new file mode 100644
index 0000000..4975b26
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/beh
@@ -0,0 +1,4 @@
1#name : -behaviour(...).
2# --
3-behaviour(${1:gen_server}).
4$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/case b/.emacs.d/mysnippets/text-mode/erlang-mode/case
new file mode 100644
index 0000000..5bed114
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/case
@@ -0,0 +1,5 @@
1#name : case ... of ... end
2# --
3case $1 of
4 $0
5end
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/compile b/.emacs.d/mysnippets/text-mode/erlang-mode/compile
new file mode 100644
index 0000000..ae3a4d8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/compile
@@ -0,0 +1,4 @@
1#name : -compile(...).
2# --
3-compile([${1:export_all}]).
4$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/def b/.emacs.d/mysnippets/text-mode/erlang-mode/def
new file mode 100644
index 0000000..6fb92f1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/def
@@ -0,0 +1,4 @@
1#name : -define(...,...).
2# --
3-define($1,$2).
4$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/exp b/.emacs.d/mysnippets/text-mode/erlang-mode/exp
new file mode 100644
index 0000000..67f56da
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/exp
@@ -0,0 +1,5 @@
1#name : -export([]).
2#contributor : hitesh <hitesh.jasani@gmail.com>
3# --
4-export([${1:start/0}]).
5$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/fun b/.emacs.d/mysnippets/text-mode/erlang-mode/fun
new file mode 100644
index 0000000..77f8293
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/fun
@@ -0,0 +1,3 @@
1#name : fun (...) -> ... end
2# --
3fun ($1) -> $0 end
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/if b/.emacs.d/mysnippets/text-mode/erlang-mode/if
new file mode 100644
index 0000000..45674c4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/if
@@ -0,0 +1,6 @@
1#name : if ... -> ... ; true -> ... end
2# --
3if
4 $1 -> $2;
5 true -> $0
6end
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/ifdef b/.emacs.d/mysnippets/text-mode/erlang-mode/ifdef
new file mode 100644
index 0000000..ea89ecf
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/ifdef
@@ -0,0 +1,5 @@
1#name : -ifdef(...). ... -endif.
2# --
3-ifdef($1).
4$0
5-endif.
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/ifndef b/.emacs.d/mysnippets/text-mode/erlang-mode/ifndef
new file mode 100644
index 0000000..dcd67a7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/ifndef
@@ -0,0 +1,5 @@
1#name : -ifndef(...). ... -endif.
2# --
3-ifndef($1).
4$0
5-endif.
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/imp b/.emacs.d/mysnippets/text-mode/erlang-mode/imp
new file mode 100644
index 0000000..c035ddd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/imp
@@ -0,0 +1,5 @@
1#name : -import([]).
2#contributor : hitesh <hitesh.jasani@gmail.com>
3# --
4-import(${1:lists}, [${2:map/2, sum/1}]).
5$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/inc b/.emacs.d/mysnippets/text-mode/erlang-mode/inc
new file mode 100644
index 0000000..f7b2161
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/inc
@@ -0,0 +1,4 @@
1#name : -include("...").
2# --
3-include("$1").
4$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/inc.lib b/.emacs.d/mysnippets/text-mode/erlang-mode/inc.lib
new file mode 100644
index 0000000..09a6723
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/inc.lib
@@ -0,0 +1,4 @@
1#name : -include_lib("...").
2# --
3-include_lib("$1").
4$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/loop b/.emacs.d/mysnippets/text-mode/erlang-mode/loop
new file mode 100644
index 0000000..0205802
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/loop
@@ -0,0 +1,8 @@
1#name : loop(...) -> receive _ -> loop(...) end.
2# --
3${1:loop}($2) ->
4 receive
5 ${3:_} ->
6 $1($2)
7 end.
8$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/mod b/.emacs.d/mysnippets/text-mode/erlang-mode/mod
new file mode 100644
index 0000000..7275d39
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/mod
@@ -0,0 +1,6 @@
1#name : -module().
2#contributor : hitesh <hitesh.jasani@gmail.com>
3# --
4-module(${1:`(file-name-nondirectory
5 (file-name-sans-extension (or (buffer-file-name) (buffer-name))))`}).
6$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/rcv b/.emacs.d/mysnippets/text-mode/erlang-mode/rcv
new file mode 100644
index 0000000..804fb3f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/rcv
@@ -0,0 +1,5 @@
1#name : receive ... -> ... end
2# --
3receive
4 $1 -> $0
5end
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/rcv.after b/.emacs.d/mysnippets/text-mode/erlang-mode/rcv.after
new file mode 100644
index 0000000..51046df
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/rcv.after
@@ -0,0 +1,6 @@
1#name : receive after ... -> ... end
2# --
3receive
4after
5 $1 -> $0
6end
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/rec b/.emacs.d/mysnippets/text-mode/erlang-mode/rec
new file mode 100644
index 0000000..0d67834
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/rec
@@ -0,0 +1,4 @@
1#name : -record(...,{...}).
2# --
3-record($1,{$2}).
4$0
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/try b/.emacs.d/mysnippets/text-mode/erlang-mode/try
new file mode 100644
index 0000000..fa5c9c2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/try
@@ -0,0 +1,7 @@
1#name : try ... of ... catch after end
2# --
3try $1 of
4 $0
5catch
6after
7end
diff --git a/.emacs.d/mysnippets/text-mode/erlang-mode/undef b/.emacs.d/mysnippets/text-mode/erlang-mode/undef
new file mode 100644
index 0000000..7ab5dd4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/erlang-mode/undef
@@ -0,0 +1,4 @@
1#name : -undef(...).
2# --
3-undef($1).
4$0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/au b/.emacs.d/mysnippets/text-mode/f90-mode/au
new file mode 100644
index 0000000..1f0af73
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/au
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : automatic
3# --
4automatic $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/bd b/.emacs.d/mysnippets/text-mode/f90-mode/bd
new file mode 100644
index 0000000..8840102
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/bd
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : block data
3# --
4block data $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/c b/.emacs.d/mysnippets/text-mode/f90-mode/c
new file mode 100644
index 0000000..c7182e4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/c
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : continue
3# --
4continue $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/ch b/.emacs.d/mysnippets/text-mode/f90-mode/ch
new file mode 100644
index 0000000..7e6b4cb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/ch
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : character
3# --
4character $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/cx b/.emacs.d/mysnippets/text-mode/f90-mode/cx
new file mode 100644
index 0000000..8feb41e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/cx
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : complex
3# --
4complex $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/dc b/.emacs.d/mysnippets/text-mode/f90-mode/dc
new file mode 100644
index 0000000..1992b1b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/dc
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : double complex
3# --
4double complex $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/do b/.emacs.d/mysnippets/text-mode/f90-mode/do
new file mode 100644
index 0000000..2c117fd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/do
@@ -0,0 +1,6 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : do while (...) end do
3# --
4do while (${1:condition})
5 $0
6end do
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/dp b/.emacs.d/mysnippets/text-mode/f90-mode/dp
new file mode 100644
index 0000000..ad014b7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/dp
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : double precision
3# --
4double precision $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/eq b/.emacs.d/mysnippets/text-mode/f90-mode/eq
new file mode 100644
index 0000000..0c6d09f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/eq
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : equivalence
3# --
4equivalence $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/ib b/.emacs.d/mysnippets/text-mode/f90-mode/ib
new file mode 100644
index 0000000..9275a12
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/ib
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : implicit byte
3# --
4implicit byte $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/ic b/.emacs.d/mysnippets/text-mode/f90-mode/ic
new file mode 100644
index 0000000..79842ea
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/ic
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : implicit complex
3# --
4implicit complex $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/ich b/.emacs.d/mysnippets/text-mode/f90-mode/ich
new file mode 100644
index 0000000..53c7f81
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/ich
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : implicit character
3# --
4implicit character $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/if b/.emacs.d/mysnippets/text-mode/f90-mode/if
new file mode 100644
index 0000000..b4fb526
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/if
@@ -0,0 +1,6 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : if then end if
3# --
4if ( ${1:condition} ) then
5 $0
6end if
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/ii b/.emacs.d/mysnippets/text-mode/f90-mode/ii
new file mode 100644
index 0000000..4b1fee5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/ii
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : implicit integer
3# --
4implicit integer $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/il b/.emacs.d/mysnippets/text-mode/f90-mode/il
new file mode 100644
index 0000000..8658af5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/il
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : implicit logical
3# --
4implicit logical $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/in b/.emacs.d/mysnippets/text-mode/f90-mode/in
new file mode 100644
index 0000000..0c1d5e1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/in
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : implicit none
3# --
4implicit none
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/inc b/.emacs.d/mysnippets/text-mode/f90-mode/inc
new file mode 100644
index 0000000..dd649c4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/inc
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : include
3# --
4include $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/intr b/.emacs.d/mysnippets/text-mode/f90-mode/intr
new file mode 100644
index 0000000..147fffd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/intr
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : intrinsic
3# --
4intrinsic $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/ir b/.emacs.d/mysnippets/text-mode/f90-mode/ir
new file mode 100644
index 0000000..fb37082
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/ir
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : implicit real
3# --
4implicit real $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/l b/.emacs.d/mysnippets/text-mode/f90-mode/l
new file mode 100644
index 0000000..8605d69
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/l
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : logical
3# --
4logical $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/pa b/.emacs.d/mysnippets/text-mode/f90-mode/pa
new file mode 100644
index 0000000..1b1b503
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/pa
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : parameter
3# --
4parameter $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/pr b/.emacs.d/mysnippets/text-mode/f90-mode/pr
new file mode 100644
index 0000000..e0f8baa
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/pr
@@ -0,0 +1,6 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : program ... end program ...
3# --
4program ${1:name}
5 $0
6end program ${1:name}
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/re b/.emacs.d/mysnippets/text-mode/f90-mode/re
new file mode 100644
index 0000000..08c7ba0
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/re
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : read (*,*)
3# --
4read (${1:*},${2:*}) $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/st b/.emacs.d/mysnippets/text-mode/f90-mode/st
new file mode 100644
index 0000000..23ae7d0
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/st
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : structure
3# --
4structure $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/su b/.emacs.d/mysnippets/text-mode/f90-mode/su
new file mode 100644
index 0000000..d3857b8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/su
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : subroutine
3# --
4subroutine $0
diff --git a/.emacs.d/mysnippets/text-mode/f90-mode/wr b/.emacs.d/mysnippets/text-mode/f90-mode/wr
new file mode 100644
index 0000000..1ac3eb9
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/f90-mode/wr
@@ -0,0 +1,4 @@
1#contributor: Li Zhu <http://www.zhuli.name>
2#name : write (*,*)
3# --
4write (${1:*},${2:*}) $0
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/body b/.emacs.d/mysnippets/text-mode/html-mode/body
new file mode 100644
index 0000000..c924f8c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/body
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <body>...</body>
3# --
4<body$1>
5 $0
6</body> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/br b/.emacs.d/mysnippets/text-mode/html-mode/br
new file mode 100644
index 0000000..3492098
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/br
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <br />
3# --
4<br /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/code b/.emacs.d/mysnippets/text-mode/html-mode/code
new file mode 100644
index 0000000..6f558ec
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/code
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <code>...</code>
3# --
4<code>
5 $0
6</code> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/code.class b/.emacs.d/mysnippets/text-mode/html-mode/code.class
new file mode 100644
index 0000000..b910eb7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/code.class
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <code class="...">...</code>
3# --
4<code class="$1">
5 $0
6</code> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/dd b/.emacs.d/mysnippets/text-mode/html-mode/dd
new file mode 100644
index 0000000..8120b13
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/dd
@@ -0,0 +1,5 @@
1#contributor : Rodrigo Setti <rodrigosetti@gmail.com>
2#name : <dd> ... </dd>
3#group : list
4# --
5<dd>$1</dd> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/div b/.emacs.d/mysnippets/text-mode/html-mode/div
new file mode 100644
index 0000000..1c9c0c8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/div
@@ -0,0 +1,3 @@
1#name : <div...>...</div>
2# --
3<div${1: id="${2:some_id}"}${3: class="${4:some_class}"}>$0</div> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/div.class b/.emacs.d/mysnippets/text-mode/html-mode/div.class
new file mode 100644
index 0000000..11c12d6
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/div.class
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <div class="...">...</div>
3# --
4<div class="$1">
5 $0
6</div> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/div.id b/.emacs.d/mysnippets/text-mode/html-mode/div.id
new file mode 100644
index 0000000..ccde64d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/div.id
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <div id="...">...</div>
3# --
4<div id="$1">
5 $0
6</div> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/div.id-class b/.emacs.d/mysnippets/text-mode/html-mode/div.id-class
new file mode 100644
index 0000000..bce8920
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/div.id-class
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <div id="..." class="...">...</div>
3# --
4<div id="$1" class="$2">
5 $0
6</div> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/dl b/.emacs.d/mysnippets/text-mode/html-mode/dl
new file mode 100644
index 0000000..be11bb5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/dl
@@ -0,0 +1,7 @@
1#contributor : Rodrigo Setti <rodrigosetti@gmail.com>
2#name : <dl> ... </dl>
3#group : list
4# --
5<dl>
6 $0
7</dl>
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/dl.id b/.emacs.d/mysnippets/text-mode/html-mode/dl.id
new file mode 100644
index 0000000..16aba53
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/dl.id
@@ -0,0 +1,7 @@
1#contributor : Rodrigo Setti <rodrigosetti@gmail.com>
2#name : <dl> ... </dl>
3#group : list
4# --
5<dl id="$1">
6 $0
7</dl> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/doctype b/.emacs.d/mysnippets/text-mode/html-mode/doctype
new file mode 100644
index 0000000..a60dfb6
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/doctype
@@ -0,0 +1,4 @@
1#name : Doctype HTML 4.01 Strict
2#group : meta
3# --
4<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhml1 b/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhml1
new file mode 100644
index 0000000..5d95e07
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhml1
@@ -0,0 +1,4 @@
1#name : DocType XHTML 1.0 frameset
2#group : meta
3# --
4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_1 b/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_1
new file mode 100644
index 0000000..fec46d7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_1
@@ -0,0 +1,4 @@
1#name : DocType XHTML 1.1
2#group : meta
3# --
4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_strict b/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_strict
new file mode 100644
index 0000000..20d95d3
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_strict
@@ -0,0 +1,4 @@
1#name : DocType XHTML 1.0 Strict
2#group : meta
3# --
4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_transitional b/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_transitional
new file mode 100644
index 0000000..c5255fc
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_transitional
@@ -0,0 +1,4 @@
1#name : DocType XHTML 1.0 Transitional
2#group : meta
3# --
4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/dov b/.emacs.d/mysnippets/text-mode/html-mode/dov
new file mode 100644
index 0000000..e8341ea
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/dov
@@ -0,0 +1,11 @@
1#name : <dov...>...</dov>
2# --
3a mirror up here $3
4
5
6<dov ${1:id="${2:some_id and here comes another nested field: ${3:nested_shit}}"}>
7 $0
8</dov>
9<dov $1>
10 actually some other shit and $3
11</dov>
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/dt b/.emacs.d/mysnippets/text-mode/html-mode/dt
new file mode 100644
index 0000000..f385cec
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/dt
@@ -0,0 +1,5 @@
1#contributor : Rodrigo Setti <rodrigosetti@gmail.com>
2#name : <dt> ... </dt>
3#group : list
4# --
5<dt>$1</dt> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/form b/.emacs.d/mysnippets/text-mode/html-mode/form
new file mode 100644
index 0000000..f1c066d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/form
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name :<form method="..." id="..." action="..."></form>
3# --
4<form method="$1" id="$2" action="$3">
5 $0
6</form> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/h1 b/.emacs.d/mysnippets/text-mode/html-mode/h1
new file mode 100644
index 0000000..414e457
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/h1
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <h1>...</h1>
3#group : header
4# --
5<h1>$1</h1> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/h2 b/.emacs.d/mysnippets/text-mode/html-mode/h2
new file mode 100644
index 0000000..3722a29
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/h2
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <h2>...</h2>
3#group : header
4# --
5<h2>$1</h2> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/h3 b/.emacs.d/mysnippets/text-mode/html-mode/h3
new file mode 100644
index 0000000..a1eaab1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/h3
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <h3>...</h3>
3#group : header
4# --
5<h3>$1</h3> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/h4 b/.emacs.d/mysnippets/text-mode/html-mode/h4
new file mode 100644
index 0000000..df71628
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/h4
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <h4>...</h4>
3#group : header
4# --
5<h4>$1</h4> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/h5 b/.emacs.d/mysnippets/text-mode/html-mode/h5
new file mode 100644
index 0000000..0109822
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/h5
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <h5>...</h5>
3#group : header
4# --
5<h5>$1</h5> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/h6 b/.emacs.d/mysnippets/text-mode/html-mode/h6
new file mode 100644
index 0000000..21c718f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/h6
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <h6>...</h6>
3#group : header
4# --
5<h6>$1</h6> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/head b/.emacs.d/mysnippets/text-mode/html-mode/head
new file mode 100644
index 0000000..d639a73
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/head
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <head>...</head>
3# --
4<head>
5 $0
6</head> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/hr b/.emacs.d/mysnippets/text-mode/html-mode/hr
new file mode 100644
index 0000000..c2c330c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/hr
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <hr />
3# --
4<hr />
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/href b/.emacs.d/mysnippets/text-mode/html-mode/href
new file mode 100644
index 0000000..121d589
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/href
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <a href="...">...</a>
3# --
4<a href="$1">$2</a> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/html b/.emacs.d/mysnippets/text-mode/html-mode/html
new file mode 100644
index 0000000..958aa6d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/html
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <html>...</html>
3# --
4<html>
5 $0
6</html>
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/html.xmlns b/.emacs.d/mysnippets/text-mode/html-mode/html.xmlns
new file mode 100644
index 0000000..7dd7ee4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/html.xmlns
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <html xmlns="...">...</html>
3# --
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${1:en}" lang="${2:en}">
5 $0
6</html>
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/img b/.emacs.d/mysnippets/text-mode/html-mode/img
new file mode 100644
index 0000000..897f605
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/img
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <img src="..." class="..." alt="..." />
3# --
4<img src="$1" class="$2" alt="$3" /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/input b/.emacs.d/mysnippets/text-mode/html-mode/input
new file mode 100644
index 0000000..c79ba87
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/input
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <input ... />
3# --
4<input type="$1" name="$2" value="$3" /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/li b/.emacs.d/mysnippets/text-mode/html-mode/li
new file mode 100644
index 0000000..c5139fa
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/li
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <li>...</li>
3#group : list
4# --
5<li>$1</li> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/li.class b/.emacs.d/mysnippets/text-mode/html-mode/li.class
new file mode 100644
index 0000000..90f0c65
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/li.class
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <li class="...">...</li>
3#group : list
4# --
5<li class="$1">$2</li> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/link.stylesheet b/.emacs.d/mysnippets/text-mode/html-mode/link.stylesheet
new file mode 100644
index 0000000..6c9de74
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/link.stylesheet
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <link stylesheet="..." />
3# --
4<link rel="${1:stylesheet}" href="${2:url}" type="${3:text/css}" media="${4:screen}" /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/link.stylesheet-ie b/.emacs.d/mysnippets/text-mode/html-mode/link.stylesheet-ie
new file mode 100644
index 0000000..4f6a776
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/link.stylesheet-ie
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <!--[if IE]><link stylesheet="..." /><![endif]-->
3# --
4<!--[if IE]>
5<link rel="${1:stylesheet}" href="${2:url}" type="${3:text/css}" media="${4:screen}" />
6<![endif]--> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/mailto b/.emacs.d/mysnippets/text-mode/html-mode/mailto
new file mode 100644
index 0000000..419f2a5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/mailto
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <a href="mailto:...@...">...</a>
3# --
4<a href="mailto:$1@$2">$0</a> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/meta b/.emacs.d/mysnippets/text-mode/html-mode/meta
new file mode 100644
index 0000000..30319ef
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/meta
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#group : meta
3#name : <meta name="..." content="..." />
4# --
5<meta name="${1:generator}" content="${2:content}" /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/meta.http-equiv b/.emacs.d/mysnippets/text-mode/html-mode/meta.http-equiv
new file mode 100644
index 0000000..c059a44
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/meta.http-equiv
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <meta http-equiv="..." content="..." />
3#group : meta
4# --
5<meta name="${1:Content-Type}" content="${2:text/html; charset=UTF-8}" /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/ol b/.emacs.d/mysnippets/text-mode/html-mode/ol
new file mode 100644
index 0000000..58899fa
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/ol
@@ -0,0 +1,7 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <ol>...</ol>
3#group : list
4# --
5<ol>
6 $0
7</ol> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/ol.class b/.emacs.d/mysnippets/text-mode/html-mode/ol.class
new file mode 100644
index 0000000..b091f08
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/ol.class
@@ -0,0 +1,7 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <ol class="...">...</ol>
3#group : list
4# --
5<ol class="$1">
6 $0
7</ol> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/ol.id b/.emacs.d/mysnippets/text-mode/html-mode/ol.id
new file mode 100644
index 0000000..13c7c06
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/ol.id
@@ -0,0 +1,7 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <ol id="...">...</ol>
3#group : list
4# --
5<ol id="$1">
6 $0
7</ol> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/p b/.emacs.d/mysnippets/text-mode/html-mode/p
new file mode 100644
index 0000000..649d9a2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/p
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <p>...</p>
3# --
4<p>$1</p> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/pre b/.emacs.d/mysnippets/text-mode/html-mode/pre
new file mode 100644
index 0000000..bfebb3c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/pre
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <pre>...</pre>
3# --
4<pre>
5 $0
6</pre> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/quote b/.emacs.d/mysnippets/text-mode/html-mode/quote
new file mode 100644
index 0000000..65ded74
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/quote
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <blockquote>...</blockquote>
3# --
4<blockquote>
5 $1
6</blockquote> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/script.javascript b/.emacs.d/mysnippets/text-mode/html-mode/script.javascript
new file mode 100644
index 0000000..bf0c3b5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/script.javascript
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name :<script type="text/javascript">...</script>
3# --
4<script type="text/javascript">
5 $0
6</script> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/script.javascript-src b/.emacs.d/mysnippets/text-mode/html-mode/script.javascript-src
new file mode 100644
index 0000000..b64c4dc
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/script.javascript-src
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name :<script type="text/javascript" src="..."></script>
3# --
4<script type="text/javascript" src="$1"></script> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/span b/.emacs.d/mysnippets/text-mode/html-mode/span
new file mode 100644
index 0000000..149758d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/span
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <span>...</span>
3# --
4<span>$1</span> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/span.class b/.emacs.d/mysnippets/text-mode/html-mode/span.class
new file mode 100644
index 0000000..2d5ee55
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/span.class
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <span class="...">...</span>
3# --
4<span class="$1">$2</span> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/span.id b/.emacs.d/mysnippets/text-mode/html-mode/span.id
new file mode 100644
index 0000000..30a81bc
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/span.id
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <span id="...">...</span>
3# --
4<span id="$1">$2</span> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/style b/.emacs.d/mysnippets/text-mode/html-mode/style
new file mode 100644
index 0000000..300bead
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/style
@@ -0,0 +1,6 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <style type="text/css" media="...">...</style>
3# --
4<style type="text/css" media="${1:screen}">
5 $0
6</style> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/table b/.emacs.d/mysnippets/text-mode/html-mode/table
new file mode 100644
index 0000000..561614f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/table
@@ -0,0 +1,7 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <table ...>...</table>
3#group : table
4# --
5<table width="$1" cellspacing="$2" cellpadding="$3" border="$4">
6 $0
7</table> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/td b/.emacs.d/mysnippets/text-mode/html-mode/td
new file mode 100644
index 0000000..4f494eb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/td
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <td>...</td>
3#group : table
4# --
5<td$1>$2</td> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/textarea b/.emacs.d/mysnippets/text-mode/html-mode/textarea
new file mode 100644
index 0000000..058498f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/textarea
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <textarea ...></textarea>
3# --
4<textarea name="$1" id="$2" rows="$3" cols="$4" tabindex="$5"></textarea> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/th b/.emacs.d/mysnippets/text-mode/html-mode/th
new file mode 100644
index 0000000..3b5fab1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/th
@@ -0,0 +1,5 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <th>...</th>
3#group : table
4# --
5<th$1>$2</th> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/title b/.emacs.d/mysnippets/text-mode/html-mode/title
new file mode 100644
index 0000000..21794cd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/title
@@ -0,0 +1,4 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <title>...</title>
3# --
4<title>$1</title> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/tr b/.emacs.d/mysnippets/text-mode/html-mode/tr
new file mode 100644
index 0000000..3878a1c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/tr
@@ -0,0 +1,7 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <tr>...</tr>
3#group : table
4# --
5<tr>
6 $0
7</tr> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/ul b/.emacs.d/mysnippets/text-mode/html-mode/ul
new file mode 100644
index 0000000..981e6e7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/ul
@@ -0,0 +1,7 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <ul>...</ul>
3#group : list
4# --
5<ul>
6 $0
7</ul> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/ul.class b/.emacs.d/mysnippets/text-mode/html-mode/ul.class
new file mode 100644
index 0000000..c1e3e91
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/ul.class
@@ -0,0 +1,7 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <ul class="...">...</ul>
3#group : list
4# --
5<ul class="$1">
6 $0
7</ul> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/html-mode/ul.id b/.emacs.d/mysnippets/text-mode/html-mode/ul.id
new file mode 100644
index 0000000..ababf37
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/html-mode/ul.id
@@ -0,0 +1,7 @@
1#contributor : Jimmy Wu <frozenthrone88@gmail.com>
2#name : <ul id="...">...</ul>
3#group : list
4# --
5<ul id="$1">
6 $0
7</ul> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/latex-mode/begin b/.emacs.d/mysnippets/text-mode/latex-mode/begin
new file mode 100644
index 0000000..dc42d2f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/latex-mode/begin
@@ -0,0 +1,7 @@
1#contributor : Rodrigo Setti <rodrigosetti@gmail.com>
2#name : \begin{environment} ... \end{environment}
3# --
4
5\begin{${1:environment}}
6$0
7\end{$1}
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/+ b/.emacs.d/mysnippets/text-mode/markdown-mode/+
new file mode 100644
index 0000000..0407169
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/+
@@ -0,0 +1,5 @@
1#name : Unordered List
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4+ ${1:Text}
5+$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/- b/.emacs.d/mysnippets/text-mode/markdown-mode/-
new file mode 100644
index 0000000..9d5c51d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/-
@@ -0,0 +1,5 @@
1#name : Unordered List
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4- ${1:Text}
5-$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/_ b/.emacs.d/mysnippets/text-mode/markdown-mode/_
new file mode 100644
index 0000000..50ab476
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/_
@@ -0,0 +1,4 @@
1#name : Emphasis
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4_${1:Text}_ $0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/__ b/.emacs.d/mysnippets/text-mode/markdown-mode/__
new file mode 100644
index 0000000..b6304f3
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/__
@@ -0,0 +1,4 @@
1#name : Strong
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4**${1:Text}** $0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/` b/.emacs.d/mysnippets/text-mode/markdown-mode/`
new file mode 100644
index 0000000..ae58211
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/`
@@ -0,0 +1,4 @@
1#name : Inline Code
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4\`${1:Code}\` $0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/h1.1 b/.emacs.d/mysnippets/text-mode/markdown-mode/h1.1
new file mode 100644
index 0000000..8bb7ea2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/h1.1
@@ -0,0 +1,6 @@
1#name : Header 1 (#)
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4# ${1:Header 1} #
5
6$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/h1.2 b/.emacs.d/mysnippets/text-mode/markdown-mode/h1.2
new file mode 100644
index 0000000..d2e7b5b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/h1.2
@@ -0,0 +1,7 @@
1#name : Header 1 (=)
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4${1:Header 1}
5${1:$(make-string (string-width text) ?\=)}
6
7$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/h2.1 b/.emacs.d/mysnippets/text-mode/markdown-mode/h2.1
new file mode 100644
index 0000000..bfee3fc
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/h2.1
@@ -0,0 +1,6 @@
1#name : Header 2 (##)
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4## ${1:Header 1} ##
5
6$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/h2.2 b/.emacs.d/mysnippets/text-mode/markdown-mode/h2.2
new file mode 100644
index 0000000..af06045
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/h2.2
@@ -0,0 +1,7 @@
1#name : Header 2 (-)
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4${1:Header 2}
5${1:$(make-string (string-width text) ?\-)}
6
7$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/h3 b/.emacs.d/mysnippets/text-mode/markdown-mode/h3
new file mode 100644
index 0000000..44a6104
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/h3
@@ -0,0 +1,6 @@
1#name : Header 3
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4### ${1:Header 3} ###
5
6$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/h4 b/.emacs.d/mysnippets/text-mode/markdown-mode/h4
new file mode 100644
index 0000000..315140a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/h4
@@ -0,0 +1,6 @@
1#name : Header 4
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4#### ${1:Header 4} ####
5
6$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/h5 b/.emacs.d/mysnippets/text-mode/markdown-mode/h5
new file mode 100644
index 0000000..f50a785
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/h5
@@ -0,0 +1,6 @@
1#name : Header 5
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4##### ${1:Header 5} #####
5
6$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/h6 b/.emacs.d/mysnippets/text-mode/markdown-mode/h6
new file mode 100644
index 0000000..1cdfebb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/h6
@@ -0,0 +1,6 @@
1#name : Header 6
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4###### ${1:Header 6} ######
5
6$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/hr.1 b/.emacs.d/mysnippets/text-mode/markdown-mode/hr.1
new file mode 100644
index 0000000..5fbe4f4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/hr.1
@@ -0,0 +1,7 @@
1#name : Horizontal Rule (-)
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4
5----------
6
7$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/hr.2 b/.emacs.d/mysnippets/text-mode/markdown-mode/hr.2
new file mode 100644
index 0000000..2d4de22
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/hr.2
@@ -0,0 +1,7 @@
1#name : Horizontal Rule (*)
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4
5*******
6
7$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/img b/.emacs.d/mysnippets/text-mode/markdown-mode/img
new file mode 100644
index 0000000..69ee77d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/img
@@ -0,0 +1,4 @@
1#name : Image
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4![${1:Alt Text}](${2:URL} $3) $0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/link b/.emacs.d/mysnippets/text-mode/markdown-mode/link
new file mode 100644
index 0000000..dd7f99b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/link
@@ -0,0 +1,4 @@
1#name : Link
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4[${1:Link Text}](${2:URL} $3) $0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/ol b/.emacs.d/mysnippets/text-mode/markdown-mode/ol
new file mode 100644
index 0000000..e715669
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/ol
@@ -0,0 +1,5 @@
1#name : Ordered List
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4${1:1}. ${2:Text}
5${1:$(number-to-string (1+ (string-to-number text)))}. $0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/rimg b/.emacs.d/mysnippets/text-mode/markdown-mode/rimg
new file mode 100644
index 0000000..caafb60
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/rimg
@@ -0,0 +1,4 @@
1#name : Referenced Image
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4![${1:Alt Text}][$2] $0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/rlb b/.emacs.d/mysnippets/text-mode/markdown-mode/rlb
new file mode 100644
index 0000000..681d9f0
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/rlb
@@ -0,0 +1,5 @@
1#name : Reference Label
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4[${1:Reference}]: ${2:URL} $3
5$0
diff --git a/.emacs.d/mysnippets/text-mode/markdown-mode/rlink b/.emacs.d/mysnippets/text-mode/markdown-mode/rlink
new file mode 100644
index 0000000..e35a0c0
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/markdown-mode/rlink
@@ -0,0 +1,4 @@
1#name : Reference Link
2#contributor: Peng Deng <dengpeng@gmail.com>
3# --
4[${1:Link Text}][$2] $0
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/body b/.emacs.d/mysnippets/text-mode/nxml-mode/body
new file mode 100644
index 0000000..ddcf0cf
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/body
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <body>...</body>
3# --
4<body$1>
5 $0
6</body> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/br b/.emacs.d/mysnippets/text-mode/nxml-mode/br
new file mode 100644
index 0000000..ba35773
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/br
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <br />
3# --
4<br /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/code b/.emacs.d/mysnippets/text-mode/nxml-mode/code
new file mode 100644
index 0000000..b7c43fd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/code
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <code>...</code>
3# --
4<code>
5 $0
6</code> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/div b/.emacs.d/mysnippets/text-mode/nxml-mode/div
new file mode 100644
index 0000000..90fbc2e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/div
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <div...>...</div>
3# --
4<div$1>$0</div> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/doctype b/.emacs.d/mysnippets/text-mode/nxml-mode/doctype
new file mode 100644
index 0000000..3fdcf17
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/doctype
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : DocType XHTML 1.1
3#group : meta
4# --
5<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_strict b/.emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_strict
new file mode 100644
index 0000000..eca5860
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_strict
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : DocType XHTML 1.0 Strict
3#group : meta
4# --
5<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_transitional b/.emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_transitional
new file mode 100644
index 0000000..fba232a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_transitional
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : DocType XHTML 1.0 Transitional
3#group : meta
4# --
5<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/form b/.emacs.d/mysnippets/text-mode/nxml-mode/form
new file mode 100644
index 0000000..252253e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/form
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name :<form method="..." action="..."></form>
3# --
4<form method="$1" action="$2">
5 $0
6</form> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/h1 b/.emacs.d/mysnippets/text-mode/nxml-mode/h1
new file mode 100644
index 0000000..bc72fd6
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/h1
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <h1>...</h1>
3#group : header
4# --
5<h1>$1</h1> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/h2 b/.emacs.d/mysnippets/text-mode/nxml-mode/h2
new file mode 100644
index 0000000..b790e56
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/h2
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <h2>...</h2>
3#group : header
4# --
5<h2>$1</h2> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/h3 b/.emacs.d/mysnippets/text-mode/nxml-mode/h3
new file mode 100644
index 0000000..7dfd9d7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/h3
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <h3>...</h3>
3#group : header
4# --
5<h3>$1</h3> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/h4 b/.emacs.d/mysnippets/text-mode/nxml-mode/h4
new file mode 100644
index 0000000..b782998
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/h4
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <h4>...</h4>
3#group : header
4# --
5<h4>$1</h4> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/h5 b/.emacs.d/mysnippets/text-mode/nxml-mode/h5
new file mode 100644
index 0000000..13a51a1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/h5
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <h5>...</h5>
3#group : header
4# --
5<h5>$1</h5> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/h6 b/.emacs.d/mysnippets/text-mode/nxml-mode/h6
new file mode 100644
index 0000000..b2f0c55
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/h6
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <h6>...</h6>
3#group : header
4# --
5<h6>$1</h6> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/head b/.emacs.d/mysnippets/text-mode/nxml-mode/head
new file mode 100644
index 0000000..91347b9
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/head
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <head>...</head>
3# --
4<head>
5 $0
6</head> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/hr b/.emacs.d/mysnippets/text-mode/nxml-mode/hr
new file mode 100644
index 0000000..a17e1db
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/hr
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <hr />
3# --
4<hr />
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/href b/.emacs.d/mysnippets/text-mode/nxml-mode/href
new file mode 100644
index 0000000..0db2fae
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/href
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <a href="...">...</a>
3# --
4<a href="$1">$2</a> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/html b/.emacs.d/mysnippets/text-mode/nxml-mode/html
new file mode 100644
index 0000000..85e09f7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/html
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <html xmlns="...">...</html>
3# --
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${1:en}" lang="${2:en}">
5 $0
6</html>
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/img b/.emacs.d/mysnippets/text-mode/nxml-mode/img
new file mode 100644
index 0000000..1f4382b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/img
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <img src="..." alt="..." />
3# --
4<img src="$1" alt="$2" /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/input b/.emacs.d/mysnippets/text-mode/nxml-mode/input
new file mode 100644
index 0000000..80c3503
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/input
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <input ... />
3# --
4<input type="$1" name="$2" value="$3" /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/li b/.emacs.d/mysnippets/text-mode/nxml-mode/li
new file mode 100644
index 0000000..c952682
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/li
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <li>...</li>
3# --
4<li>$1</li> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/link b/.emacs.d/mysnippets/text-mode/nxml-mode/link
new file mode 100644
index 0000000..d93b7a5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/link
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <link stylesheet="..." />
3# --
4<link rel="${1:stylesheet}" href="${2:url}" type="${3:text/css}" media="${4:screen}" /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/meta b/.emacs.d/mysnippets/text-mode/nxml-mode/meta
new file mode 100644
index 0000000..dfee1f2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/meta
@@ -0,0 +1,5 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <meta name="..." content="..." />
3#group : meta
4# --
5<meta name="${1:generator}" content="${2:content}" /> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/name b/.emacs.d/mysnippets/text-mode/nxml-mode/name
new file mode 100644
index 0000000..592d0da
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/name
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <a name="..."></a>
3# --
4<a name="$1"></a> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/ol b/.emacs.d/mysnippets/text-mode/nxml-mode/ol
new file mode 100644
index 0000000..16cfe8d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/ol
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <ol>...</ol>
3# --
4<ol>
5 $0
6</ol> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/p b/.emacs.d/mysnippets/text-mode/nxml-mode/p
new file mode 100644
index 0000000..6845ba5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/p
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <p>...</p>
3# --
4<p>$1</p> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/pre b/.emacs.d/mysnippets/text-mode/nxml-mode/pre
new file mode 100644
index 0000000..d70b722
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/pre
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <pre>...</pre>
3# --
4<pre>
5 $0
6</pre> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/quote b/.emacs.d/mysnippets/text-mode/nxml-mode/quote
new file mode 100644
index 0000000..20fed1e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/quote
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <blockquote>...</blockquote>
3# --
4<blockquote>
5 $1
6</blockquote> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/span b/.emacs.d/mysnippets/text-mode/nxml-mode/span
new file mode 100644
index 0000000..a0bba2a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/span
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <span>...</span>
3# --
4<span>$1</span> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/style b/.emacs.d/mysnippets/text-mode/nxml-mode/style
new file mode 100644
index 0000000..b80be1c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/style
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <style type="text/css" media="...">...</style>
3# --
4<style type="text/css" media="${1:screen}">
5 $0
6</style> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/table b/.emacs.d/mysnippets/text-mode/nxml-mode/table
new file mode 100644
index 0000000..03fd119
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/table
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <table>...</table>
3# --
4<table>
5 $0
6</table> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/tag.1l b/.emacs.d/mysnippets/text-mode/nxml-mode/tag.1l
new file mode 100644
index 0000000..8988635
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/tag.1l
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <tag>...</tag>
3# --
4<${1:tag}>$2</$1>$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/tag.2l b/.emacs.d/mysnippets/text-mode/nxml-mode/tag.2l
new file mode 100644
index 0000000..08b4a26
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/tag.2l
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <tag> \n...\n</tag>
3# --
4<${1:tag}>
5 $2
6</$1>$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/td b/.emacs.d/mysnippets/text-mode/nxml-mode/td
new file mode 100644
index 0000000..f4615a7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/td
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <td>...</td>
3# --
4<td$1>$2</td> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/th b/.emacs.d/mysnippets/text-mode/nxml-mode/th
new file mode 100644
index 0000000..d988b20
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/th
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <th>...</th>
3# --
4<th$1>$2</th> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/title b/.emacs.d/mysnippets/text-mode/nxml-mode/title
new file mode 100644
index 0000000..7cd238a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/title
@@ -0,0 +1,4 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <title>...</title>
3# --
4<title>$1</title> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/tr b/.emacs.d/mysnippets/text-mode/nxml-mode/tr
new file mode 100644
index 0000000..c72daf2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/tr
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <tr>...</tr>
3# --
4<tr>
5 $0
6</tr> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/nxml-mode/ul b/.emacs.d/mysnippets/text-mode/nxml-mode/ul
new file mode 100644
index 0000000..dac5a66
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/nxml-mode/ul
@@ -0,0 +1,6 @@
1#contributor : Anders Bach Nielsen <abachn@abachn.net>
2#name : <ul>...</ul>
3# --
4<ul>
5 $0
6</ul> \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/eval b/.emacs.d/mysnippets/text-mode/perl-mode/eval
new file mode 100644
index 0000000..c1f1e1b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/eval
@@ -0,0 +1,8 @@
1#name : eval { ... } if ($@) { ... }
2# --
3eval {
4 ${1:# do something risky...}
5};
6if (\$@) {
7 ${2:# handle failure...}
8} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/for b/.emacs.d/mysnippets/text-mode/perl-mode/for
new file mode 100644
index 0000000..ec5532f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/for
@@ -0,0 +1,5 @@
1#name : for (...) { ... }
2# --
3for (my \$${1:var} = 0; \$$1 < ${2:expression}; \$$1++) {
4 ${3:# body...}
5} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/fore b/.emacs.d/mysnippets/text-mode/perl-mode/fore
new file mode 100644
index 0000000..c878a0e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/fore
@@ -0,0 +1,5 @@
1#name : foreach ... { ... }
2# --
3foreach my \$${1:x} (@${2:array}) {
4 ${3:# body...}
5} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/if b/.emacs.d/mysnippets/text-mode/perl-mode/if
new file mode 100644
index 0000000..3191b97
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/if
@@ -0,0 +1,5 @@
1#name : if (...) { ... }
2# --
3if ($1) {
4 $0
5} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/ife b/.emacs.d/mysnippets/text-mode/perl-mode/ife
new file mode 100644
index 0000000..23f7cf6
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/ife
@@ -0,0 +1,7 @@
1#name : if (...) { ... } else { ... }
2# --
3if ($1) {
4 $2
5} else {
6 $3
7} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/ifee b/.emacs.d/mysnippets/text-mode/perl-mode/ifee
new file mode 100644
index 0000000..7c187d1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/ifee
@@ -0,0 +1,9 @@
1#name : if, elsif, else ...
2# --
3if ($1) {
4 ${2:# body...}
5} elsif ($3) {
6 ${4:# elsif...}
7} else {
8 ${5:# else...}
9} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/sub b/.emacs.d/mysnippets/text-mode/perl-mode/sub
new file mode 100644
index 0000000..5ab54d7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/sub
@@ -0,0 +1,5 @@
1#name : sub ... { ... }
2# --
3sub ${1:function_name} {
4 $0
5} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/unless b/.emacs.d/mysnippets/text-mode/perl-mode/unless
new file mode 100644
index 0000000..baeffa2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/unless
@@ -0,0 +1,5 @@
1#name : unless (...) { ... }
2# --
3unless ($1) {
4 $0
5} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/while b/.emacs.d/mysnippets/text-mode/perl-mode/while
new file mode 100644
index 0000000..9c2c470
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/while
@@ -0,0 +1,5 @@
1#name : while (...) { ... }
2# --
3while ($1) {
4 $0
5} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/xfore b/.emacs.d/mysnippets/text-mode/perl-mode/xfore
new file mode 100644
index 0000000..58e455d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/xfore
@@ -0,0 +1,3 @@
1#name : ... foreach ...
2# --
3${1:expression} foreach @${2:array}; \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/xif b/.emacs.d/mysnippets/text-mode/perl-mode/xif
new file mode 100644
index 0000000..1d4dba8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/xif
@@ -0,0 +1,3 @@
1#name : ... if ...
2# --
3${1:expression} if ${2:condition} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/xunless b/.emacs.d/mysnippets/text-mode/perl-mode/xunless
new file mode 100644
index 0000000..f456db3
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/xunless
@@ -0,0 +1,3 @@
1#name : ... unless ...
2# --
3${1:expression} unless ${2:condition} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/perl-mode/xwhile b/.emacs.d/mysnippets/text-mode/perl-mode/xwhile
new file mode 100644
index 0000000..2515586
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/perl-mode/xwhile
@@ -0,0 +1,3 @@
1#name : ... while ...
2# --
3${1:expression} while ${2:condition}; \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/__ b/.emacs.d/mysnippets/text-mode/python-mode/__
new file mode 100644
index 0000000..a67dc49
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/__
@@ -0,0 +1,3 @@
1#name : __...__
2# --
3__${init}__ \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/class b/.emacs.d/mysnippets/text-mode/python-mode/class
new file mode 100644
index 0000000..72f339b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/class
@@ -0,0 +1,54 @@
1# -*- coding: utf-8 -*-
2# name: class
3# contributor: Orestis Markou
4# contributor: Nishio Hirokazu
5# contributor: Yasser González Fernández <yglez@uh.cu>
6# --
7class ${1:ClassName}(${2:object}):
8 """$3
9 """
10
11 def __init__(self, $4):
12 """$5
13 ${4:$
14 (let* ((indent
15 (concat "\n" (make-string (current-column) 32)))
16 (args
17 (mapconcat
18 '(lambda (x)
19 (if (not (string= (nth 0 x) ""))
20 (concat "- " (char-to-string 96) (nth 0 x)
21 (char-to-string 96) ":")))
22 (mapcar
23 '(lambda (x)
24 (mapcar
25 (lambda (x)
26 (replace-regexp-in-string "[[:blank:]]*$" ""
27 (replace-regexp-in-string "^[[:blank:]]*" "" x))) x))
28 (mapcar '(lambda (x) (split-string x "="))
29 (split-string text ",")))
30 indent)))
31 (if (string= args "")
32 (make-string 3 34)
33 (mapconcat
34 'identity
35 (list "" "Arguments:" args (make-string 3 34))
36 indent)))
37 }
38 ${4:$
39 (mapconcat
40 '(lambda (x)
41 (if (not (string= (nth 0 x) ""))
42 (concat "self._" (nth 0 x) " = " (nth 0 x))))
43 (mapcar
44 '(lambda (x)
45 (mapcar
46 '(lambda (x)
47 (replace-regexp-in-string "[[:blank:]]*$" ""
48 (replace-regexp-in-string "^[[:blank:]]*" "" x)))
49 x))
50 (mapcar '(lambda (x) (split-string x "="))
51 (split-string text ",")))
52 (concat "\n" (make-string (current-column) 32)))
53 }
54 $0
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/def b/.emacs.d/mysnippets/text-mode/python-mode/def
new file mode 100644
index 0000000..f82f791
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/def
@@ -0,0 +1,35 @@
1# -*- coding: utf-8 -*-
2# name: def
3# contributor: Orestis Markou
4# contributor: Yasser González Fernández <yglez@uh.cu>
5# --
6def ${1:name}($2):
7 """$3
8 ${2:$
9 (let*
10 ((indent
11 (concat "\n" (make-string (current-column) 32)))
12 (args
13 (mapconcat
14 '(lambda (x)
15 (if (not (string= (nth 0 x) ""))
16 (concat "- " (char-to-string 96) (nth 0 x)
17 (char-to-string 96) ":")))
18 (mapcar
19 '(lambda (x)
20 (mapcar
21 '(lambda (x)
22 (replace-regexp-in-string "[[:blank:]]*$" ""
23 (replace-regexp-in-string "^[[:blank:]]*" "" x)))
24 x))
25 (mapcar '(lambda (x) (split-string x "="))
26 (split-string text ",")))
27 indent)))
28 (if (string= args "")
29 (make-string 3 34)
30 (mapconcat
31 'identity
32 (list "" "Arguments:" args (make-string 3 34))
33 indent)))
34 }
35 $0
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/defm b/.emacs.d/mysnippets/text-mode/python-mode/defm
new file mode 100644
index 0000000..dc25827
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/defm
@@ -0,0 +1,33 @@
1# -*- coding: utf-8 -*-
2# name: defm
3# contributor: Yasser Gonz¨¢lez Fern¨¢ndez <yglez@uh.cu>
4# --
5def ${1:name}(self, $2):
6 """$3
7 ${2:$
8 (let* ((indent
9 (concat "\n" (make-string (current-column) 32)))
10 (args
11 (mapconcat
12 '(lambda (x)
13 (if (not (string= (nth 0 x) ""))
14 (concat "- " (char-to-string 96) (nth 0 x)
15 (char-to-string 96) ":")))
16 (mapcar
17 '(lambda (x)
18 (mapcar
19 '(lambda (x)
20 (replace-regexp-in-string "[[:blank:]]*$" ""
21 (replace-regexp-in-string "^[[:blank:]]*" "" x)))
22 x))
23 (mapcar '(lambda (x) (split-string x "="))
24 (split-string text ",")))
25 indent)))
26 (if (string= args "")
27 (make-string 3 34)
28 (mapconcat
29 'identity
30 (list "" "Arguments:" args (make-string 3 34))
31 indent)))
32 }
33 $0
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/for b/.emacs.d/mysnippets/text-mode/python-mode/for
new file mode 100644
index 0000000..84f3ddd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/for
@@ -0,0 +1,4 @@
1#name : for ... in ... : ...
2# --
3for ${var} in ${collection}:
4 $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/ifmain b/.emacs.d/mysnippets/text-mode/python-mode/ifmain
new file mode 100644
index 0000000..6224923
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/ifmain
@@ -0,0 +1,4 @@
1#name : if __name__ == '__main__': ...
2# --
3if __name__ == '__main__':
4 $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/prop b/.emacs.d/mysnippets/text-mode/python-mode/prop
new file mode 100644
index 0000000..107730a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/prop
@@ -0,0 +1,15 @@
1# contributor: Mads D. Kristensen <madsdk@gmail.com>
2# name: prop
3# --
4def ${1:foo}():
5 doc = """${2:Doc string}"""
6 def fget(self):
7 return self._$1
8 def fset(self, value):
9 self._$1 = value
10 def fdel(self):
11 del self._$1
12 return locals()
13$1 = property(**$1())
14
15$0
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/propg b/.emacs.d/mysnippets/text-mode/python-mode/propg
new file mode 100644
index 0000000..7e994b6
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/propg
@@ -0,0 +1,9 @@
1#contributor : Julio Carlos Menendez <godinblack@gmail.com>
2#name : _get_foo ... foo=property(...)
3# --
4def _get_${1:foo}(self):
5 return self._$1
6
7$1 = property(_get_$1)
8
9$0
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/propsg b/.emacs.d/mysnippets/text-mode/python-mode/propsg
new file mode 100644
index 0000000..e09d82a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/propsg
@@ -0,0 +1,12 @@
1#contributor : Julio Carlos Menendez <godinblack@gmail.com>
2#name : _get_foo ... _set_foo ... foo=property(...)
3# --
4def _set_${1:foo}(self, value):
5 self._$1 = value
6
7def _get_$1(self):
8 return self._$1
9
10$1 = property(_get_$1, _set_$1)
11
12$0
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/while b/.emacs.d/mysnippets/text-mode/python-mode/while
new file mode 100644
index 0000000..704dd7c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/while
@@ -0,0 +1,4 @@
1#name : while ... : ...
2# --
3while ${condition}:
4 $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/rst-mode/chap b/.emacs.d/mysnippets/text-mode/rst-mode/chap
new file mode 100644
index 0000000..6474c00
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/rst-mode/chap
@@ -0,0 +1,6 @@
1#name : Chapter title
2# --
3${1:Chapter}
4${1:$(make-string (string-width text) ?\=)}
5
6$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/rst-mode/sec b/.emacs.d/mysnippets/text-mode/rst-mode/sec
new file mode 100644
index 0000000..76087ed
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/rst-mode/sec
@@ -0,0 +1,6 @@
1#name : Section title
2# --
3${1:Section}
4${1:$(make-string (string-width text) ?\-)}
5
6$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/rst-mode/tit b/.emacs.d/mysnippets/text-mode/rst-mode/tit
new file mode 100644
index 0000000..cac2e77
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/rst-mode/tit
@@ -0,0 +1,7 @@
1#name : Document title
2# --
3${1:$(make-string (string-width text) ?\=)}
4${1:Title}
5${1:$(make-string (string-width text) ?\=)}
6
7$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/# b/.emacs.d/mysnippets/text-mode/ruby-mode/#
new file mode 100644
index 0000000..33581c8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/#
@@ -0,0 +1,4 @@
1#name : # =>
2#group : general
3# --
4# => \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/=b b/.emacs.d/mysnippets/text-mode/ruby-mode/=b
new file mode 100644
index 0000000..22a013f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/=b
@@ -0,0 +1,6 @@
1#name : =begin rdoc ... =end
2#group : general
3# --
4=begin rdoc
5 $0
6=end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/Comp b/.emacs.d/mysnippets/text-mode/ruby-mode/Comp
new file mode 100644
index 0000000..03f2b35
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/Comp
@@ -0,0 +1,8 @@
1#name : include Comparable; def <=> ... end
2#group : definitions
3# --
4include Comparable
5
6def <=> other
7 $0
8end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/all b/.emacs.d/mysnippets/text-mode/ruby-mode/all
new file mode 100644
index 0000000..a98a9f4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/all
@@ -0,0 +1,4 @@
1#name : all? { |...| ... }
2#group : collections
3# --
4all? { |${e}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/am b/.emacs.d/mysnippets/text-mode/ruby-mode/am
new file mode 100644
index 0000000..7675a97
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/am
@@ -0,0 +1,4 @@
1#name : alias_method new, old
2#group : definitions
3# --
4alias_method :${new_name}, :${old_name} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/any b/.emacs.d/mysnippets/text-mode/ruby-mode/any
new file mode 100644
index 0000000..d0b6dd2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/any
@@ -0,0 +1,4 @@
1#name : any? { |...| ... }
2#group : collections
3# --
4any? { |${e}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/app b/.emacs.d/mysnippets/text-mode/ruby-mode/app
new file mode 100644
index 0000000..19bf60a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/app
@@ -0,0 +1,6 @@
1#name : if __FILE__ == $PROGRAM_NAME ... end
2#group : general
3# --
4if __FILE__ == $PROGRAM_NAME
5 $0
6end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/bm b/.emacs.d/mysnippets/text-mode/ruby-mode/bm
new file mode 100644
index 0000000..4789f64
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/bm
@@ -0,0 +1,6 @@
1#name : Benchmark.bmbm(...) do ... end
2#group : general
3# --
4Benchmark.bmbm(${1:10}) do |x|
5 $0
6end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/case b/.emacs.d/mysnippets/text-mode/ruby-mode/case
new file mode 100644
index 0000000..40c3529
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/case
@@ -0,0 +1,7 @@
1#name : case ... end
2#group : general
3# --
4case ${1:object}
5when ${2:condition}
6 $0
7end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/cla b/.emacs.d/mysnippets/text-mode/ruby-mode/cla
new file mode 100644
index 0000000..81ccf45
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/cla
@@ -0,0 +1,6 @@
1#name : class << self ... end
2#group : definitions
3# --
4class << ${self}
5 $0
6end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/classify b/.emacs.d/mysnippets/text-mode/ruby-mode/classify
new file mode 100644
index 0000000..2378afa
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/classify
@@ -0,0 +1,4 @@
1#name : classify { |...| ... }
2#group : collections
3# --
4classify { |${e}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/cls b/.emacs.d/mysnippets/text-mode/ruby-mode/cls
new file mode 100644
index 0000000..da28fb7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/cls
@@ -0,0 +1,13 @@
1#name : class ... end
2#contributor : hitesh <hitesh.jasani@gmail.com>
3#group : definitions
4# --
5class ${1:`(let ((fn (capitalize (file-name-nondirectory
6 (file-name-sans-extension
7 (or (buffer-file-name)
8 (buffer-name (current-buffer))))))))
9 (cond
10 ((string-match "_" fn) (replace-match "" nil nil fn))
11 (t fn)))`}
12 $0
13end
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/collect b/.emacs.d/mysnippets/text-mode/ruby-mode/collect
new file mode 100644
index 0000000..934014a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/collect
@@ -0,0 +1,4 @@
1#name : collect { |...| ... }
2#group : collections
3# --
4collect { |${e}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/dee b/.emacs.d/mysnippets/text-mode/ruby-mode/dee
new file mode 100644
index 0000000..56d0a18
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/dee
@@ -0,0 +1,4 @@
1#name : deep_copy(...)
2#group : general
3# --
4Marshal.load(Marshal.dump($0)) \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/deli b/.emacs.d/mysnippets/text-mode/ruby-mode/deli
new file mode 100644
index 0000000..843b154
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/deli
@@ -0,0 +1,4 @@
1#name : delete_if { |...| ... }
2#group : collections
3# --
4delete_if { |${e} $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/det b/.emacs.d/mysnippets/text-mode/ruby-mode/det
new file mode 100644
index 0000000..6a17da9
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/det
@@ -0,0 +1,4 @@
1#name : detect { |...| ... }
2#group : collections
3# --
4detect { |${e}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/dow b/.emacs.d/mysnippets/text-mode/ruby-mode/dow
new file mode 100644
index 0000000..3b65271
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/dow
@@ -0,0 +1,6 @@
1#name : downto(...) { |n| ... }
2#group : control structure
3# --
4downto(${0}) { |${n}|
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/ea b/.emacs.d/mysnippets/text-mode/ruby-mode/ea
new file mode 100644
index 0000000..9cdf8dc
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/ea
@@ -0,0 +1,4 @@
1#name : each { |...| ... }
2#group : collections
3# --
4each { |${e}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/eac b/.emacs.d/mysnippets/text-mode/ruby-mode/eac
new file mode 100644
index 0000000..f0d9cb1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/eac
@@ -0,0 +1,4 @@
1#name : each_cons(...) { |...| ... }
2#group : collections
3# --
4each_cons(${1:2}) { |${group}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/eai b/.emacs.d/mysnippets/text-mode/ruby-mode/eai
new file mode 100644
index 0000000..5b0ed67
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/eai
@@ -0,0 +1,4 @@
1#name : each_index { |i| ... }
2#group : collections
3# --
4each_index { |${i}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/eav b/.emacs.d/mysnippets/text-mode/ruby-mode/eav
new file mode 100644
index 0000000..558e5b4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/eav
@@ -0,0 +1,4 @@
1#name : each_value { |val| ... }
2#group : collections
3# --
4each_value { |${val}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/eawi b/.emacs.d/mysnippets/text-mode/ruby-mode/eawi
new file mode 100644
index 0000000..edf8418
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/eawi
@@ -0,0 +1,4 @@
1#name : each_with_index { |e, i| ... }
2#group : collections
3# --
4each_with_index { |${e}, ${i}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/forin b/.emacs.d/mysnippets/text-mode/ruby-mode/forin
new file mode 100644
index 0000000..36b4387
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/forin
@@ -0,0 +1,6 @@
1#name : for ... in ...; ... end
2#group : control structure
3# --
4for ${1:element} in ${2:collection}
5 $0
6end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/if b/.emacs.d/mysnippets/text-mode/ruby-mode/if
new file mode 100644
index 0000000..077b097
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/if
@@ -0,0 +1,6 @@
1#name : if ... end
2#group : control structure
3# --
4if ${1:condition}
5 $0
6end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/ife b/.emacs.d/mysnippets/text-mode/ruby-mode/ife
new file mode 100644
index 0000000..e57d395
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/ife
@@ -0,0 +1,8 @@
1#name : if ... else ... end
2#group : control structure
3# --
4if ${1:condition}
5 $2
6else
7 $3
8end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/inject b/.emacs.d/mysnippets/text-mode/ruby-mode/inject
new file mode 100644
index 0000000..37932e5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/inject
@@ -0,0 +1,4 @@
1#name : inject(...) { |...| ... }
2#group : collections
3# --
4inject(${1:0}) { |${2:injection}, ${3:element}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/mm b/.emacs.d/mysnippets/text-mode/ruby-mode/mm
new file mode 100644
index 0000000..3f62b10
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/mm
@@ -0,0 +1,6 @@
1#name : def method_missing ... end
2#group : definitions
3# --
4def method_missing(method, *args)
5 $0
6end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/r b/.emacs.d/mysnippets/text-mode/ruby-mode/r
new file mode 100644
index 0000000..2e7b797
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/r
@@ -0,0 +1,4 @@
1#name : attr_reader ...
2#group : definitions
3# --
4attr_reader : \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/rb b/.emacs.d/mysnippets/text-mode/ruby-mode/rb
new file mode 100644
index 0000000..74d26dd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/rb
@@ -0,0 +1,4 @@
1#name : /usr/bin/ruby -wKU
2#group : general
3# --
4#!/usr/bin/ruby -wKU
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/reject b/.emacs.d/mysnippets/text-mode/ruby-mode/reject
new file mode 100644
index 0000000..c2501bc
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/reject
@@ -0,0 +1,4 @@
1#name : reject { |...| ... }
2#group : collections
3# --
4reject { |${1:element}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/req b/.emacs.d/mysnippets/text-mode/ruby-mode/req
new file mode 100644
index 0000000..3e001ec
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/req
@@ -0,0 +1,4 @@
1#name : require "..."
2#group : general
3# --
4require "$0" \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/rreq b/.emacs.d/mysnippets/text-mode/ruby-mode/rreq
new file mode 100644
index 0000000..0b9c6a4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/rreq
@@ -0,0 +1,4 @@
1#name : require File.join(File.dirname(__FILE__), ...)
2#group : general
3# --
4require File.join(File.dirname(__FILE__), $0) \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/rw b/.emacs.d/mysnippets/text-mode/ruby-mode/rw
new file mode 100644
index 0000000..a364675
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/rw
@@ -0,0 +1,4 @@
1#name : attr_accessor ...
2#group : definitions
3# --
4attr_accessor : \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/select b/.emacs.d/mysnippets/text-mode/ruby-mode/select
new file mode 100644
index 0000000..78bca8f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/select
@@ -0,0 +1,4 @@
1#name : select { |...| ... }
2#group : collections
3# --
4select { |${1:element}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/tim b/.emacs.d/mysnippets/text-mode/ruby-mode/tim
new file mode 100644
index 0000000..0da115f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/tim
@@ -0,0 +1,4 @@
1#name : times { |n| ... }
2#group : control structure
3# --
4times { |${n}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/until b/.emacs.d/mysnippets/text-mode/ruby-mode/until
new file mode 100644
index 0000000..476966a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/until
@@ -0,0 +1,6 @@
1#name : until ... end
2#group: control structure
3# --
4until ${condition}
5 $0
6end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/upt b/.emacs.d/mysnippets/text-mode/ruby-mode/upt
new file mode 100644
index 0000000..6fc6810
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/upt
@@ -0,0 +1,6 @@
1#name : upto(...) { |n| ... }
2#group : control structure
3# --
4upto(${n}) { |${i}|
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/w b/.emacs.d/mysnippets/text-mode/ruby-mode/w
new file mode 100644
index 0000000..9edbfcb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/w
@@ -0,0 +1,4 @@
1#name : attr_writer ...
2#group : definitions
3# --
4attr_writer : \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/when b/.emacs.d/mysnippets/text-mode/ruby-mode/when
new file mode 100644
index 0000000..9b06f21
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/when
@@ -0,0 +1,6 @@
1#name : when ... end
2#group : control structure
3# --
4when ${condition}
5 $0
6end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/while b/.emacs.d/mysnippets/text-mode/ruby-mode/while
new file mode 100644
index 0000000..4c9ad35
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/while
@@ -0,0 +1,6 @@
1#name : while ... end
2#group : control structure
3# --
4while ${condition}
5 $0
6end \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/y b/.emacs.d/mysnippets/text-mode/ruby-mode/y
new file mode 100644
index 0000000..0ddf0f9
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/y
@@ -0,0 +1,4 @@
1#name : :yields: arguments (rdoc)
2#group : general
3# --
4:yields: $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/ruby-mode/zip b/.emacs.d/mysnippets/text-mode/ruby-mode/zip
new file mode 100644
index 0000000..56f4266
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/ruby-mode/zip
@@ -0,0 +1,4 @@
1#name : zip(...) { |...| ... }
2#group : collections
3# --
4zip(${enums}) { |${row}| $0 } \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/act b/.emacs.d/mysnippets/text-mode/scala-mode/act
new file mode 100644
index 0000000..fce52fc
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/act
@@ -0,0 +1,10 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def act = { ..}
3# --
4def act = {
5 loop {
6 react {
7 $0
8 }
9 }
10} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/act.arg b/.emacs.d/mysnippets/text-mode/scala-mode/act.arg
new file mode 100644
index 0000000..fc6df9e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/act.arg
@@ -0,0 +1,10 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def act(arg: T) = { ..}
3# --
4def act(${1:arg}: ${2:type}) = {
5 loop {
6 react {
7 $0
8 }
9 }
10} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/actor b/.emacs.d/mysnippets/text-mode/scala-mode/actor
new file mode 100644
index 0000000..d38a183
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/actor
@@ -0,0 +1,10 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : val a = actor { ..}
3# --
4val a = actor {
5 loop {
6 react {
7 $0
8 }
9 }
10} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/ano b/.emacs.d/mysnippets/text-mode/scala-mode/ano
new file mode 100644
index 0000000..b949801
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/ano
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : (args) => ...
3# --
4($1) => ${2:body} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/app b/.emacs.d/mysnippets/text-mode/scala-mode/app
new file mode 100644
index 0000000..b89bab9
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/app
@@ -0,0 +1,6 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : object name extends Application
3# --
4object ${1:name} extends Application {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/arr.new b/.emacs.d/mysnippets/text-mode/scala-mode/arr.new
new file mode 100644
index 0000000..e3297ca
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/arr.new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : Array[T](..)
3# --
4Array[${1:value}](${2:args}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/arr.val-new b/.emacs.d/mysnippets/text-mode/scala-mode/arr.val-new
new file mode 100644
index 0000000..4de4720
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/arr.val-new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : val a = Array[T](..)
3# --
4val ${1:arr} = Array[${2:value}](${3:args}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/asof b/.emacs.d/mysnippets/text-mode/scala-mode/asof
new file mode 100644
index 0000000..3b2b209
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/asof
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : asInstanceOf[T]
3# --
4asInstanceOf[${1:type}] $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/ass b/.emacs.d/mysnippets/text-mode/scala-mode/ass
new file mode 100644
index 0000000..653dcef
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/ass
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : assert(x === y)
3# --
4assert(${1:x} === ${2:y}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/ass.true b/.emacs.d/mysnippets/text-mode/scala-mode/ass.true
new file mode 100644
index 0000000..923c518
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/ass.true
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : assert(true)
3# --
4assert(true) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/at.author b/.emacs.d/mysnippets/text-mode/scala-mode/at.author
new file mode 100644
index 0000000..82fe4cc
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/at.author
@@ -0,0 +1,4 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : @author name
3# --
4@author ${1:name} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/at.param b/.emacs.d/mysnippets/text-mode/scala-mode/at.param
new file mode 100644
index 0000000..72b6e79
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/at.param
@@ -0,0 +1,4 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : @param name description
3# --
4@param ${1:name} ${2:description} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/at.return b/.emacs.d/mysnippets/text-mode/scala-mode/at.return
new file mode 100644
index 0000000..9c3f41c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/at.return
@@ -0,0 +1,4 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : @return description
3# --
4@return ${1:description} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/at.version b/.emacs.d/mysnippets/text-mode/scala-mode/at.version
new file mode 100644
index 0000000..1158ce2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/at.version
@@ -0,0 +1,4 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : @version number
3# --
4@version ${1:0.1} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/bang b/.emacs.d/mysnippets/text-mode/scala-mode/bang
new file mode 100644
index 0000000..a547da8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/bang
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : actor ! message
3# --
4${1:actor} ! ${2:message} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/case b/.emacs.d/mysnippets/text-mode/scala-mode/case
new file mode 100644
index 0000000..13d6aec
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/case
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : case pattern =>
3# --
4case ${1:pattern} => $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/case.match-all b/.emacs.d/mysnippets/text-mode/scala-mode/case.match-all
new file mode 100644
index 0000000..028bf5f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/case.match-all
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : case _ =>
3# --
4case _ => $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/cast b/.emacs.d/mysnippets/text-mode/scala-mode/cast
new file mode 100644
index 0000000..3b2b209
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/cast
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : asInstanceOf[T]
3# --
4asInstanceOf[${1:type}] $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/cc b/.emacs.d/mysnippets/text-mode/scala-mode/cc
new file mode 100644
index 0000000..7ed1142
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/cc
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : case class T(arg: A)
3# --
4case class ${1:name}(${2:arg}: ${3:type}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/cl b/.emacs.d/mysnippets/text-mode/scala-mode/cl
new file mode 100644
index 0000000..1fd712c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/cl
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : class T { .. }
3# --
4class ${1:name} {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/cl.abs b/.emacs.d/mysnippets/text-mode/scala-mode/cl.abs
new file mode 100644
index 0000000..402dec7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/cl.abs
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : abstract class T { .. }
3# --
4abstract class ${1:name} {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/cl.abs-arg b/.emacs.d/mysnippets/text-mode/scala-mode/cl.abs-arg
new file mode 100644
index 0000000..fe29524
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/cl.abs-arg
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : abstract class T(args) { .. }
3# --
4abstract class ${1:name}(${2:args}) {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/cl.arg b/.emacs.d/mysnippets/text-mode/scala-mode/cl.arg
new file mode 100644
index 0000000..f82460f
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/cl.arg
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : class T(args) { .. }
3# --
4class ${1:name}(${2:args}) {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/clof b/.emacs.d/mysnippets/text-mode/scala-mode/clof
new file mode 100644
index 0000000..955726c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/clof
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : classOf[T]
3# --
4classOf[${1:type}] $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/co b/.emacs.d/mysnippets/text-mode/scala-mode/co
new file mode 100644
index 0000000..75b1f3b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/co
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : case object T
3# --
4case object ${1:name} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/cons b/.emacs.d/mysnippets/text-mode/scala-mode/cons
new file mode 100644
index 0000000..a48e4ff
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/cons
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : element1 :: element2
3# --
4${1:element1} :: ${2:element2} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/cons.nil b/.emacs.d/mysnippets/text-mode/scala-mode/cons.nil
new file mode 100644
index 0000000..c288f93
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/cons.nil
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : element1 :: Nil
3# --
4${1:element1} :: Nil $0
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/def.arg b/.emacs.d/mysnippets/text-mode/scala-mode/def.arg
new file mode 100644
index 0000000..7765bbf
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/def.arg
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def f(arg: T) = ...
3# --
4def ${1:name}(${2:args}) = $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/def.arg-body b/.emacs.d/mysnippets/text-mode/scala-mode/def.arg-body
new file mode 100644
index 0000000..e6e278e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/def.arg-body
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def f(arg: T) = {...}
3# --
4def ${1:name}(${2:args}) = {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret b/.emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret
new file mode 100644
index 0000000..dddb9ce
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def f(arg: T): R = ...
3# --
4def ${1:name}(${2:args}): ${3:Unit} = $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret-body b/.emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret-body
new file mode 100644
index 0000000..862f7fd
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret-body
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def f(arg: T): R = {...}
3# --
4def ${1:name}(${2:args}): ${3:Unit} = {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/def.body b/.emacs.d/mysnippets/text-mode/scala-mode/def.body
new file mode 100644
index 0000000..858908c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/def.body
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def f = {...}
3# --
4def ${1:name} = {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/def.ret b/.emacs.d/mysnippets/text-mode/scala-mode/def.ret
new file mode 100644
index 0000000..e5483fb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/def.ret
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def f: R = ...
3# --
4def ${1:name}: ${2:Unit} = $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/def.ret-body b/.emacs.d/mysnippets/text-mode/scala-mode/def.ret-body
new file mode 100644
index 0000000..f342e04
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/def.ret-body
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def f: R = {...}
3# --
4def ${1:name}: ${3:Unit} = {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/def.simple b/.emacs.d/mysnippets/text-mode/scala-mode/def.simple
new file mode 100644
index 0000000..4814c73
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/def.simple
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : def f = ...
3# --
4def ${1:name} = $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/doc.class b/.emacs.d/mysnippets/text-mode/scala-mode/doc.class
new file mode 100644
index 0000000..60442f1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/doc.class
@@ -0,0 +1,8 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : /** cls/trt/obj name */
3# --
4/**
5 * `(scala-mode-find-clstrtobj-name-doc)`
6 * ${1:description}
7 * $0
8 */ \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/doc.def b/.emacs.d/mysnippets/text-mode/scala-mode/doc.def
new file mode 100644
index 0000000..8a3d614
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/doc.def
@@ -0,0 +1,6 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : /** method name */
3# --
4/**
5 * `(scala-mode-def-and-args-doc)`
6 */ \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/doc.file b/.emacs.d/mysnippets/text-mode/scala-mode/doc.file
new file mode 100644
index 0000000..7da4289
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/doc.file
@@ -0,0 +1,9 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : /** file name */
3# --
4/**
5 * `(scala-mode-file-doc)`
6 * $0
7 * @author ${1:name}
8 * @version ${2:0.1}
9 */ \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala b/.emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala
new file mode 100644
index 0000000..6719348
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala
@@ -0,0 +1,16 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : /** scala file */
3# --
4/* __ *\
5** ________ ___ / / ___ Scala $3 **
6** / __/ __// _ | / / / _ | (c) 2005-`(format-time-string "%Y")` , LAMP/EPFL **
7** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
8** /____/\___/_/ |_/____/_/ | | **
9** |/ **
10\* */
11/**
12 * $0
13 * @author ${1:name}
14 * @version ${2:0.1}
15 * $Id$
16 */ \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala-api b/.emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala-api
new file mode 100644
index 0000000..4a762f5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala-api
@@ -0,0 +1,16 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : /** scala api file */
3# --
4/* __ *\
5** ________ ___ / / ___ Scala API **
6** / __/ __// _ | / / / _ | (c) 2005-`(format-time-string "%Y")`, LAMP/EPFL **
7** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
8** /____/\___/_/ |_/____/_/ | | **
9** |/ **
10\* */
11/**
12 * $0
13 * @author ${1:name}
14 * @version ${2:0.1}
15 * $Id$
16 */ \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/doc.scaladoc b/.emacs.d/mysnippets/text-mode/scala-mode/doc.scaladoc
new file mode 100644
index 0000000..038428c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/doc.scaladoc
@@ -0,0 +1,7 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : /** ... */
3# --
4/**
5 * ${1:description}
6 * $0
7 */ \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/expect b/.emacs.d/mysnippets/text-mode/scala-mode/expect
new file mode 100644
index 0000000..94c742c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/expect
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : expect(value) { ..}
3# --
4expect(${1:reply}) {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/ext b/.emacs.d/mysnippets/text-mode/scala-mode/ext
new file mode 100644
index 0000000..e256317
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/ext
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : extends T
3# --
4extends $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/for.extract b/.emacs.d/mysnippets/text-mode/scala-mode/for.extract
new file mode 100644
index 0000000..60f1155
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/for.extract
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : x <- xs
3# --
4${1:x} <- ${2:xs} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/for.if b/.emacs.d/mysnippets/text-mode/scala-mode/for.if
new file mode 100644
index 0000000..f44c544
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/for.if
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : for (x <- xs if guard) { ... }
3# --
4for (${1:x} <- ${2:xs} if ${3:guard}) {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/for.loop b/.emacs.d/mysnippets/text-mode/scala-mode/for.loop
new file mode 100644
index 0000000..050d5e8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/for.loop
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : for (x <- xs) { ... }
3# --
4for (${1:x} <- ${2:xs}) {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/for.multi b/.emacs.d/mysnippets/text-mode/scala-mode/for.multi
new file mode 100644
index 0000000..c512067
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/for.multi
@@ -0,0 +1,9 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : for {x <- xs \ y <- ys} { yield }
3# --
4for {
5 ${1:x} <- ${2:xs}
6 ${3:x} <- ${4:xs}
7} {
8 yield $0
9} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/foreach b/.emacs.d/mysnippets/text-mode/scala-mode/foreach
new file mode 100644
index 0000000..cafdd00
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/foreach
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : foreach(x => ..)
3# --
4foreach(${1:x} => ${2:body}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/hmap.new b/.emacs.d/mysnippets/text-mode/scala-mode/hmap.new
new file mode 100644
index 0000000..dd564a0
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/hmap.new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : new HashMap[K, V]
3# --
4new HashMap[${1:key}, ${2:value}] $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/hmap.val-new b/.emacs.d/mysnippets/text-mode/scala-mode/hmap.val-new
new file mode 100644
index 0000000..2f4a3c2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/hmap.val-new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : val m = new HashMap[K, V]
3# --
4val ${1:m} = new HashMap[${2:key}, ${3:value}] $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/hset.new b/.emacs.d/mysnippets/text-mode/scala-mode/hset.new
new file mode 100644
index 0000000..d1be3ee
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/hset.new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : new HashSet[K]
3# --
4new HashSet[${1:key}] $0
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/hset.val-new b/.emacs.d/mysnippets/text-mode/scala-mode/hset.val-new
new file mode 100644
index 0000000..ba792a2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/hset.val-new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : val m = new HashSet[K]
3# --
4val ${1:m} = new HashSet[${2:key}] $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/if b/.emacs.d/mysnippets/text-mode/scala-mode/if
new file mode 100644
index 0000000..24891c0
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/if
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : if (cond) { .. }
3# --
4if (${1:condition}) {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/if.else b/.emacs.d/mysnippets/text-mode/scala-mode/if.else
new file mode 100644
index 0000000..ebff471
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/if.else
@@ -0,0 +1,8 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : if (cond) { .. } else { .. }
3# --
4if (${1:condition}) {
5 $2
6} else {
7 $0
8} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/imp b/.emacs.d/mysnippets/text-mode/scala-mode/imp
new file mode 100644
index 0000000..cf5efa1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/imp
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : import ..
3# --
4import $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/intercept b/.emacs.d/mysnippets/text-mode/scala-mode/intercept
new file mode 100644
index 0000000..4725eaa
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/intercept
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : intercept(classOf[T]) { ..}
3# --
4intercept(classOf[${1:Exception]}) {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/isof b/.emacs.d/mysnippets/text-mode/scala-mode/isof
new file mode 100644
index 0000000..a3538c8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/isof
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : isInstanceOf[T]
3# --
4isInstanceOf[${1:type}] $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/ls.new b/.emacs.d/mysnippets/text-mode/scala-mode/ls.new
new file mode 100644
index 0000000..7a28e61
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/ls.new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : List(..)
3# --
4List(${1:args}, ${2:args}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/ls.val-new b/.emacs.d/mysnippets/text-mode/scala-mode/ls.val-new
new file mode 100644
index 0000000..37138f0
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/ls.val-new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : val l = List(..)
3# --
4val ${1:l} = List(${2:args}, ${3:args}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/main b/.emacs.d/mysnippets/text-mode/scala-mode/main
new file mode 100644
index 0000000..ad314b3
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/main
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name: def main(args: Array[String]) = { ... }
3# --
4def main(args: Array[String]) = {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/map b/.emacs.d/mysnippets/text-mode/scala-mode/map
new file mode 100644
index 0000000..17322a5
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/map
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : map(x => ..)
3# --
4map(${1:x} => ${2:body}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/map.new b/.emacs.d/mysnippets/text-mode/scala-mode/map.new
new file mode 100644
index 0000000..21c95fb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/map.new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : Map(key -> value)
3# --
4Map(${1:key} -> ${2:value}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/match b/.emacs.d/mysnippets/text-mode/scala-mode/match
new file mode 100644
index 0000000..e85fac1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/match
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : cc match { .. }
3# --
4${1:cc} match {
5 case ${2:pattern} => $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/match.can b/.emacs.d/mysnippets/text-mode/scala-mode/match.can
new file mode 100644
index 0000000..77d475b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/match.can
@@ -0,0 +1,11 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : can match { case Full(res) => .. }
3# --
4${1:option} match {
5 case Full(res) => $0
6
7 case Empty =>
8
9 case Failure(msg, _, _) =>
10
11} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/match.option b/.emacs.d/mysnippets/text-mode/scala-mode/match.option
new file mode 100644
index 0000000..5b098f1
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/match.option
@@ -0,0 +1,8 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : option match { case None => .. }
3# --
4${1:option} match {
5 case None => $0
6 case Some(res) =>
7
8} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/mix b/.emacs.d/mysnippets/text-mode/scala-mode/mix
new file mode 100644
index 0000000..5261e32
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/mix
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : trait T { .. }
3# --
4trait ${1:name} {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/ob b/.emacs.d/mysnippets/text-mode/scala-mode/ob
new file mode 100644
index 0000000..efbc82e
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/ob
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : object name extends T
3# --
4object ${1:name} extends ${2:type} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/pac b/.emacs.d/mysnippets/text-mode/scala-mode/pac
new file mode 100644
index 0000000..ed32216
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/pac
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : package ..
3# --
4package $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/pr.newline b/.emacs.d/mysnippets/text-mode/scala-mode/pr.newline
new file mode 100644
index 0000000..77088cb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/pr.newline
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : println(..)
3# --
4println(${1:obj}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/pr.simple b/.emacs.d/mysnippets/text-mode/scala-mode/pr.simple
new file mode 100644
index 0000000..3a73f9d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/pr.simple
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : print(..)
3# --
4print(${1:obj}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/pr.string b/.emacs.d/mysnippets/text-mode/scala-mode/pr.string
new file mode 100644
index 0000000..9c06ef7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/pr.string
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : println("..")
3# --
4println("${1:msg}") $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/pr.trace b/.emacs.d/mysnippets/text-mode/scala-mode/pr.trace
new file mode 100644
index 0000000..9a0579c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/pr.trace
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : println("obj: " + obj)
3# --
4println("${1:obj}: " + ${1:obj}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/pri b/.emacs.d/mysnippets/text-mode/scala-mode/pri
new file mode 100644
index 0000000..643ef2c
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/pri
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : private
3# --
4private $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/pri.param b/.emacs.d/mysnippets/text-mode/scala-mode/pri.param
new file mode 100644
index 0000000..e53638a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/pri.param
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : private[this]
3# --
4private[${1:this}] $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/pro b/.emacs.d/mysnippets/text-mode/scala-mode/pro
new file mode 100644
index 0000000..e4b7b59
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/pro
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : protected
3# --
4protected $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/pro.param b/.emacs.d/mysnippets/text-mode/scala-mode/pro.param
new file mode 100644
index 0000000..712b050
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/pro.param
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : protected[this]
3# --
4protected[${1:this}] $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/suite b/.emacs.d/mysnippets/text-mode/scala-mode/suite
new file mode 100644
index 0000000..a65cea7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/suite
@@ -0,0 +1,8 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : class T extends Suite { .. }
3# --
4import org.scalatest._
5
6class ${1:name} extends Suite {
7 $0
8} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/test b/.emacs.d/mysnippets/text-mode/scala-mode/test
new file mode 100644
index 0000000..c4d13f6
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/test
@@ -0,0 +1,7 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : @Test def testX = ...
3# --
4//@Test
5def test${1:name} = {
6 $0
7} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/throw b/.emacs.d/mysnippets/text-mode/scala-mode/throw
new file mode 100644
index 0000000..f9a4932
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/throw
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : throw new Exception
3# --
4throw new ${1:Exception}(${2:msg}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/tr b/.emacs.d/mysnippets/text-mode/scala-mode/tr
new file mode 100644
index 0000000..68d8162
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/tr
@@ -0,0 +1,6 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : trait T { .. }
3# --
4trait ${1:name} {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/tr.ext b/.emacs.d/mysnippets/text-mode/scala-mode/tr.ext
new file mode 100644
index 0000000..2b82154
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/tr.ext
@@ -0,0 +1,6 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : trait T extends C { .. }
3# --
4trait ${1:name} extends ${2:class} {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/tr.ext-with b/.emacs.d/mysnippets/text-mode/scala-mode/tr.ext-with
new file mode 100644
index 0000000..8edb409
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/tr.ext-with
@@ -0,0 +1,6 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : trait T1 extends C with T2 { .. }
3# --
4trait ${1:name} extends ${2:class} with ${3:trait} {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/tr.with b/.emacs.d/mysnippets/text-mode/scala-mode/tr.with
new file mode 100644
index 0000000..19801eb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/tr.with
@@ -0,0 +1,6 @@
1#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
2#name : trait T1 with T2 { .. }
3# --
4trait ${1:name} with ${2:trait} {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/try b/.emacs.d/mysnippets/text-mode/scala-mode/try
new file mode 100644
index 0000000..0c33f10
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/try
@@ -0,0 +1,9 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : try { .. } catch { case e => ..}
3# --
4try {
5 $0
6} catch {
7 case ${1:e}: ${2:Exception} =>
8 ${1:println(\"ERROR: \" + e) // TODO: handle exception}\n}
9} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/try.catch-finally b/.emacs.d/mysnippets/text-mode/scala-mode/try.catch-finally
new file mode 100644
index 0000000..f146a20
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/try.catch-finally
@@ -0,0 +1,11 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : try { .. } catch { case e => ..} finally { ..}
3# --
4try {
5 $0
6} catch {
7 case ${1:e}: ${2:Exception} =>
8 ${1:println(\"ERROR: \" + e) // TODO: handle exception}\n}
9} finally {
10
11} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/try.finally b/.emacs.d/mysnippets/text-mode/scala-mode/try.finally
new file mode 100644
index 0000000..63625f2
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/try.finally
@@ -0,0 +1,8 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : try { .. } finally { .. }
3# --
4try {
5
6} finally {
7 $0
8} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/tup.arrow b/.emacs.d/mysnippets/text-mode/scala-mode/tup.arrow
new file mode 100644
index 0000000..4e7ad69
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/tup.arrow
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : element1 -> element2
3# --
4${1:element1} -> ${2:element2} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/tup.paren b/.emacs.d/mysnippets/text-mode/scala-mode/tup.paren
new file mode 100644
index 0000000..4bff202
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/tup.paren
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : (element1, element2)
3# --
4(${1:element1}, ${2:element2}) $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/val b/.emacs.d/mysnippets/text-mode/scala-mode/val
new file mode 100644
index 0000000..3067cd4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/val
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : val name = ..
3# --
4val ${1:name} = ${2:obj} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/val.new b/.emacs.d/mysnippets/text-mode/scala-mode/val.new
new file mode 100644
index 0000000..35a0c6a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/val.new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : val name = new ..
3# --
4val ${1:name} = new ${2:obj} $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/val.ret b/.emacs.d/mysnippets/text-mode/scala-mode/val.ret
new file mode 100644
index 0000000..4bf4f10
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/val.ret
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : val name: T = ..
3# --
4val ${1:name}: ${2:T} = ${3:obj} $0
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/var b/.emacs.d/mysnippets/text-mode/scala-mode/var
new file mode 100644
index 0000000..662d6c8
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/var
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : var name = ..
3# --
4var ${1:name} = ${2:obj} $0
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/var.new b/.emacs.d/mysnippets/text-mode/scala-mode/var.new
new file mode 100644
index 0000000..d681c4a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/var.new
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : var name = new ..
3# --
4var ${1:name} = new ${2:obj} $0
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/var.ret b/.emacs.d/mysnippets/text-mode/scala-mode/var.ret
new file mode 100644
index 0000000..9d0ac3a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/var.ret
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : var name: T = ..
3# --
4var ${1:name}: ${2:T} = ${3:obj} $0
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/whi b/.emacs.d/mysnippets/text-mode/scala-mode/whi
new file mode 100644
index 0000000..082c139
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/whi
@@ -0,0 +1,6 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : while(cond) { .. }
3# --
4while (${1:condition}) {
5 $0
6} \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/scala-mode/with b/.emacs.d/mysnippets/text-mode/scala-mode/with
new file mode 100644
index 0000000..6bd94e4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/scala-mode/with
@@ -0,0 +1,4 @@
1#Author : Jonas Bonèr <jonas@jonasboner.com>
2#name : with T
3# --
4with $0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/snippet-mode/field b/.emacs.d/mysnippets/text-mode/snippet-mode/field
new file mode 100644
index 0000000..bdaf0d4
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/snippet-mode/field
@@ -0,0 +1,5 @@
1# name : ${ ... } field
2# contributor : joaotavora
3# key : $f
4# --
5\${${1:${2:n}:}$3${4:\$(${5:lisp-fn})}\}$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/snippet-mode/mirror b/.emacs.d/mysnippets/text-mode/snippet-mode/mirror
new file mode 100644
index 0000000..1c32eeb
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/snippet-mode/mirror
@@ -0,0 +1,5 @@
1# name : ${n:$(...)} mirror
2# key : $m
3# contributor : joaotavora
4# --
5\${${2:n}:${4:\$(${5:reflection-fn})}\}$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/snippet-mode/vars b/.emacs.d/mysnippets/text-mode/snippet-mode/vars
new file mode 100644
index 0000000..ea5a8c7
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/snippet-mode/vars
@@ -0,0 +1,9 @@
1# name : Snippet header
2# contributor : joaotavora
3# --
4# name : $1${2:
5# key : ${3:expand-key}}${4:
6# group : ${5:group}}
7# contributor : $6
8# --
9$0 \ No newline at end of file
diff --git a/.emacs.d/mysnippets/text-mode/sql-mode/column b/.emacs.d/mysnippets/text-mode/sql-mode/column
new file mode 100644
index 0000000..90e4963
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/sql-mode/column
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : , ColumnName ColumnType NOT NULL...
3# --
4 , ${1:Name} ${2:Type} ${3:NOT NULL}
diff --git a/.emacs.d/mysnippets/text-mode/sql-mode/constraint b/.emacs.d/mysnippets/text-mode/sql-mode/constraint
new file mode 100644
index 0000000..989e508
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/sql-mode/constraint
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : CONSTRAINT [..] PRIMARY KEY ...
3# --
4CONSTRAINT [${1:PK_Name}] PRIMARY KEY ${2:CLUSTERED} ([${3:ColumnName}])
diff --git a/.emacs.d/mysnippets/text-mode/sql-mode/constraint.1 b/.emacs.d/mysnippets/text-mode/sql-mode/constraint.1
new file mode 100644
index 0000000..98d89f0
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/sql-mode/constraint.1
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : CONSTRAINT [..] FOREIGN KEY ...
3# --
4CONSTRAINT [${1:FK_Name}] FOREIGN KEY ${2:CLUSTERED} ([${3:ColumnName}])
diff --git a/.emacs.d/mysnippets/text-mode/sql-mode/create b/.emacs.d/mysnippets/text-mode/sql-mode/create
new file mode 100644
index 0000000..a34624d
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/sql-mode/create
@@ -0,0 +1,10 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : create table ...
3# --
4CREATE TABLE [${1:dbo}].[${2:TableName}]
5(
6 ${3:Id} ${4:INT IDENTITY(1,1)} ${5:NOT NULL}
7$0
8 CONSTRAINT [${6:PK_}] PRIMARY KEY ${7:CLUSTERED} ([$3])
9)
10GO
diff --git a/.emacs.d/mysnippets/text-mode/sql-mode/create.1 b/.emacs.d/mysnippets/text-mode/sql-mode/create.1
new file mode 100644
index 0000000..1323daf
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/sql-mode/create.1
@@ -0,0 +1,12 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : create procedure ...
3# --
4CREATE PROCEDURE [${1:dbo}].[${2:Name}]
5(
6 $3 $4 = ${5:NULL} ${6:OUTPUT}
7)
8AS
9BEGIN
10$0
11END
12GO
diff --git a/.emacs.d/mysnippets/text-mode/sql-mode/references b/.emacs.d/mysnippets/text-mode/sql-mode/references
new file mode 100644
index 0000000..f2e4eab
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/sql-mode/references
@@ -0,0 +1,4 @@
1#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
2#name : REFERENCES ...
3# --
4REFERENCES ${1:TableName}([${2:ColumnName}])
diff --git a/.emacs.d/mysnippets/text-mode/time b/.emacs.d/mysnippets/text-mode/time
new file mode 100644
index 0000000..d744f1a
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/time
@@ -0,0 +1,3 @@
1#name : (current time)
2# --
3`(current-time-string)` \ No newline at end of file