From 7bf6712498ad2618bee7bf5b3866fb6da0772339 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Thu, 19 Sep 2013 22:27:58 +0200 Subject: All snippets imported, init file polished --- .emacs | 80 +- .emacs.d/lisp/yasnippet.el | 3676 ++++++++++++++++++++ .../mysnippets/text-mode/cc-mode/c++-mode/beginend | 3 + .../mysnippets/text-mode/cc-mode/c++-mode/class | 8 + .emacs.d/mysnippets/text-mode/cc-mode/c++-mode/ns | 3 + .../mysnippets/text-mode/cc-mode/c++-mode/template | 3 + .../mysnippets/text-mode/cc-mode/c++-mode/using | 4 + .emacs.d/mysnippets/text-mode/cc-mode/c-mode/fopen | 3 + .../mysnippets/text-mode/cc-mode/c-mode/printf | 6 + .../text-mode/cc-mode/csharp-mode/attrib | 7 + .../text-mode/cc-mode/csharp-mode/attrib.1 | 21 + .../text-mode/cc-mode/csharp-mode/attrib.2 | 21 + .../mysnippets/text-mode/cc-mode/csharp-mode/class | 21 + .../text-mode/cc-mode/csharp-mode/comment | 6 + .../text-mode/cc-mode/csharp-mode/comment.1 | 4 + .../text-mode/cc-mode/csharp-mode/comment.2 | 4 + .../text-mode/cc-mode/csharp-mode/comment.3 | 4 + .../text-mode/cc-mode/csharp-mode/method | 10 + .../text-mode/cc-mode/csharp-mode/namespace | 7 + .../mysnippets/text-mode/cc-mode/csharp-mode/prop | 16 + .../text-mode/cc-mode/csharp-mode/region | 6 + .../mysnippets/text-mode/cc-mode/csharp-mode/using | 4 + .../text-mode/cc-mode/csharp-mode/using.1 | 4 + .../text-mode/cc-mode/csharp-mode/using.2 | 4 + .emacs.d/mysnippets/text-mode/cc-mode/do | 6 + .emacs.d/mysnippets/text-mode/cc-mode/for | 6 + .emacs.d/mysnippets/text-mode/cc-mode/if | 6 + .emacs.d/mysnippets/text-mode/cc-mode/inc | 3 + .emacs.d/mysnippets/text-mode/cc-mode/inc.1 | 3 + .emacs.d/mysnippets/text-mode/cc-mode/main | 7 + .../mysnippets/text-mode/cc-mode/objc-mode/prop | 13 + .emacs.d/mysnippets/text-mode/cc-mode/once | 8 + .emacs.d/mysnippets/text-mode/cc-mode/struct | 6 + .emacs.d/mysnippets/text-mode/css-mode/bg | 3 + .emacs.d/mysnippets/text-mode/css-mode/bg.1 | 3 + .emacs.d/mysnippets/text-mode/css-mode/bor | 3 + .emacs.d/mysnippets/text-mode/css-mode/cl | 4 + .emacs.d/mysnippets/text-mode/css-mode/disp.block | 4 + .emacs.d/mysnippets/text-mode/css-mode/disp.inline | 4 + .emacs.d/mysnippets/text-mode/css-mode/disp.none | 4 + .emacs.d/mysnippets/text-mode/css-mode/ff | 4 + .emacs.d/mysnippets/text-mode/css-mode/fs | 4 + .emacs.d/mysnippets/text-mode/css-mode/mar.bottom | 4 + .emacs.d/mysnippets/text-mode/css-mode/mar.left | 4 + .emacs.d/mysnippets/text-mode/css-mode/mar.mar | 4 + .emacs.d/mysnippets/text-mode/css-mode/mar.margin | 4 + .emacs.d/mysnippets/text-mode/css-mode/mar.right | 4 + .emacs.d/mysnippets/text-mode/css-mode/mar.top | 4 + .emacs.d/mysnippets/text-mode/css-mode/pad.bottom | 4 + .emacs.d/mysnippets/text-mode/css-mode/pad.left | 4 + .emacs.d/mysnippets/text-mode/css-mode/pad.pad | 4 + .emacs.d/mysnippets/text-mode/css-mode/pad.padding | 4 + .emacs.d/mysnippets/text-mode/css-mode/pad.right | 4 + .emacs.d/mysnippets/text-mode/css-mode/pad.top | 4 + .../mysnippets/text-mode/emacs-lisp-mode/.read_me | 11 + .../mysnippets/text-mode/emacs-lisp-mode/defun | 11 + .../text-mode/emacs-lisp-mode/dired.process_marked | 16 + .../text-mode/emacs-lisp-mode/file.process | 17 + .../text-mode/emacs-lisp-mode/file.read-lines | 17 + .../text-mode/emacs-lisp-mode/find-replace | 17 + .../text-mode/emacs-lisp-mode/grabstring | 4 + .../mysnippets/text-mode/emacs-lisp-mode/grabthing | 4 + .../text-mode/emacs-lisp-mode/traverse_dir | 6 + .../text-mode/emacs-lisp-mode/word-or-region | 27 + .emacs.d/mysnippets/text-mode/email | 3 + .emacs.d/mysnippets/text-mode/erlang-mode/after | 4 + .emacs.d/mysnippets/text-mode/erlang-mode/begin | 5 + .emacs.d/mysnippets/text-mode/erlang-mode/beh | 4 + .emacs.d/mysnippets/text-mode/erlang-mode/case | 5 + .emacs.d/mysnippets/text-mode/erlang-mode/compile | 4 + .emacs.d/mysnippets/text-mode/erlang-mode/def | 4 + .emacs.d/mysnippets/text-mode/erlang-mode/exp | 5 + .emacs.d/mysnippets/text-mode/erlang-mode/fun | 3 + .emacs.d/mysnippets/text-mode/erlang-mode/if | 6 + .emacs.d/mysnippets/text-mode/erlang-mode/ifdef | 5 + .emacs.d/mysnippets/text-mode/erlang-mode/ifndef | 5 + .emacs.d/mysnippets/text-mode/erlang-mode/imp | 5 + .emacs.d/mysnippets/text-mode/erlang-mode/inc | 4 + .emacs.d/mysnippets/text-mode/erlang-mode/inc.lib | 4 + .emacs.d/mysnippets/text-mode/erlang-mode/loop | 8 + .emacs.d/mysnippets/text-mode/erlang-mode/mod | 6 + .emacs.d/mysnippets/text-mode/erlang-mode/rcv | 5 + .../mysnippets/text-mode/erlang-mode/rcv.after | 6 + .emacs.d/mysnippets/text-mode/erlang-mode/rec | 4 + .emacs.d/mysnippets/text-mode/erlang-mode/try | 7 + .emacs.d/mysnippets/text-mode/erlang-mode/undef | 4 + .emacs.d/mysnippets/text-mode/f90-mode/au | 4 + .emacs.d/mysnippets/text-mode/f90-mode/bd | 4 + .emacs.d/mysnippets/text-mode/f90-mode/c | 4 + .emacs.d/mysnippets/text-mode/f90-mode/ch | 4 + .emacs.d/mysnippets/text-mode/f90-mode/cx | 4 + .emacs.d/mysnippets/text-mode/f90-mode/dc | 4 + .emacs.d/mysnippets/text-mode/f90-mode/do | 6 + .emacs.d/mysnippets/text-mode/f90-mode/dp | 4 + .emacs.d/mysnippets/text-mode/f90-mode/eq | 4 + .emacs.d/mysnippets/text-mode/f90-mode/ib | 4 + .emacs.d/mysnippets/text-mode/f90-mode/ic | 4 + .emacs.d/mysnippets/text-mode/f90-mode/ich | 4 + .emacs.d/mysnippets/text-mode/f90-mode/if | 6 + .emacs.d/mysnippets/text-mode/f90-mode/ii | 4 + .emacs.d/mysnippets/text-mode/f90-mode/il | 4 + .emacs.d/mysnippets/text-mode/f90-mode/in | 4 + .emacs.d/mysnippets/text-mode/f90-mode/inc | 4 + .emacs.d/mysnippets/text-mode/f90-mode/intr | 4 + .emacs.d/mysnippets/text-mode/f90-mode/ir | 4 + .emacs.d/mysnippets/text-mode/f90-mode/l | 4 + .emacs.d/mysnippets/text-mode/f90-mode/pa | 4 + .emacs.d/mysnippets/text-mode/f90-mode/pr | 6 + .emacs.d/mysnippets/text-mode/f90-mode/re | 4 + .emacs.d/mysnippets/text-mode/f90-mode/st | 4 + .emacs.d/mysnippets/text-mode/f90-mode/su | 4 + .emacs.d/mysnippets/text-mode/f90-mode/wr | 4 + .emacs.d/mysnippets/text-mode/html-mode/body | 6 + .emacs.d/mysnippets/text-mode/html-mode/br | 4 + .emacs.d/mysnippets/text-mode/html-mode/code | 6 + .emacs.d/mysnippets/text-mode/html-mode/code.class | 6 + .emacs.d/mysnippets/text-mode/html-mode/dd | 5 + .emacs.d/mysnippets/text-mode/html-mode/div | 3 + .emacs.d/mysnippets/text-mode/html-mode/div.class | 6 + .emacs.d/mysnippets/text-mode/html-mode/div.id | 6 + .../mysnippets/text-mode/html-mode/div.id-class | 6 + .emacs.d/mysnippets/text-mode/html-mode/dl | 7 + .emacs.d/mysnippets/text-mode/html-mode/dl.id | 7 + .emacs.d/mysnippets/text-mode/html-mode/doctype | 4 + .../mysnippets/text-mode/html-mode/doctype.xhml1 | 4 + .../text-mode/html-mode/doctype.xhtml1_1 | 4 + .../text-mode/html-mode/doctype.xhtml1_strict | 4 + .../html-mode/doctype.xhtml1_transitional | 4 + .emacs.d/mysnippets/text-mode/html-mode/dov | 11 + .emacs.d/mysnippets/text-mode/html-mode/dt | 5 + .emacs.d/mysnippets/text-mode/html-mode/form | 6 + .emacs.d/mysnippets/text-mode/html-mode/h1 | 5 + .emacs.d/mysnippets/text-mode/html-mode/h2 | 5 + .emacs.d/mysnippets/text-mode/html-mode/h3 | 5 + .emacs.d/mysnippets/text-mode/html-mode/h4 | 5 + .emacs.d/mysnippets/text-mode/html-mode/h5 | 5 + .emacs.d/mysnippets/text-mode/html-mode/h6 | 5 + .emacs.d/mysnippets/text-mode/html-mode/head | 6 + .emacs.d/mysnippets/text-mode/html-mode/hr | 4 + .emacs.d/mysnippets/text-mode/html-mode/href | 4 + .emacs.d/mysnippets/text-mode/html-mode/html | 6 + .emacs.d/mysnippets/text-mode/html-mode/html.xmlns | 6 + .emacs.d/mysnippets/text-mode/html-mode/img | 4 + .emacs.d/mysnippets/text-mode/html-mode/input | 4 + .emacs.d/mysnippets/text-mode/html-mode/li | 5 + .emacs.d/mysnippets/text-mode/html-mode/li.class | 5 + .../mysnippets/text-mode/html-mode/link.stylesheet | 4 + .../text-mode/html-mode/link.stylesheet-ie | 6 + .emacs.d/mysnippets/text-mode/html-mode/mailto | 4 + .emacs.d/mysnippets/text-mode/html-mode/meta | 5 + .../mysnippets/text-mode/html-mode/meta.http-equiv | 5 + .emacs.d/mysnippets/text-mode/html-mode/ol | 7 + .emacs.d/mysnippets/text-mode/html-mode/ol.class | 7 + .emacs.d/mysnippets/text-mode/html-mode/ol.id | 7 + .emacs.d/mysnippets/text-mode/html-mode/p | 4 + .emacs.d/mysnippets/text-mode/html-mode/pre | 6 + .emacs.d/mysnippets/text-mode/html-mode/quote | 6 + .../text-mode/html-mode/script.javascript | 6 + .../text-mode/html-mode/script.javascript-src | 4 + .emacs.d/mysnippets/text-mode/html-mode/span | 4 + .emacs.d/mysnippets/text-mode/html-mode/span.class | 4 + .emacs.d/mysnippets/text-mode/html-mode/span.id | 4 + .emacs.d/mysnippets/text-mode/html-mode/style | 6 + .emacs.d/mysnippets/text-mode/html-mode/table | 7 + .emacs.d/mysnippets/text-mode/html-mode/td | 5 + .emacs.d/mysnippets/text-mode/html-mode/textarea | 4 + .emacs.d/mysnippets/text-mode/html-mode/th | 5 + .emacs.d/mysnippets/text-mode/html-mode/title | 4 + .emacs.d/mysnippets/text-mode/html-mode/tr | 7 + .emacs.d/mysnippets/text-mode/html-mode/ul | 7 + .emacs.d/mysnippets/text-mode/html-mode/ul.class | 7 + .emacs.d/mysnippets/text-mode/html-mode/ul.id | 7 + .emacs.d/mysnippets/text-mode/latex-mode/begin | 7 + .emacs.d/mysnippets/text-mode/markdown-mode/+ | 5 + .emacs.d/mysnippets/text-mode/markdown-mode/- | 5 + .emacs.d/mysnippets/text-mode/markdown-mode/_ | 4 + .emacs.d/mysnippets/text-mode/markdown-mode/__ | 4 + .emacs.d/mysnippets/text-mode/markdown-mode/` | 4 + .emacs.d/mysnippets/text-mode/markdown-mode/h1.1 | 6 + .emacs.d/mysnippets/text-mode/markdown-mode/h1.2 | 7 + .emacs.d/mysnippets/text-mode/markdown-mode/h2.1 | 6 + .emacs.d/mysnippets/text-mode/markdown-mode/h2.2 | 7 + .emacs.d/mysnippets/text-mode/markdown-mode/h3 | 6 + .emacs.d/mysnippets/text-mode/markdown-mode/h4 | 6 + .emacs.d/mysnippets/text-mode/markdown-mode/h5 | 6 + .emacs.d/mysnippets/text-mode/markdown-mode/h6 | 6 + .emacs.d/mysnippets/text-mode/markdown-mode/hr.1 | 7 + .emacs.d/mysnippets/text-mode/markdown-mode/hr.2 | 7 + .emacs.d/mysnippets/text-mode/markdown-mode/img | 4 + .emacs.d/mysnippets/text-mode/markdown-mode/link | 4 + .emacs.d/mysnippets/text-mode/markdown-mode/ol | 5 + .emacs.d/mysnippets/text-mode/markdown-mode/rimg | 4 + .emacs.d/mysnippets/text-mode/markdown-mode/rlb | 5 + .emacs.d/mysnippets/text-mode/markdown-mode/rlink | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/body | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/br | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/code | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/div | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/doctype | 5 + .../text-mode/nxml-mode/doctype.xhtml1_strict | 5 + .../nxml-mode/doctype.xhtml1_transitional | 5 + .emacs.d/mysnippets/text-mode/nxml-mode/form | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/h1 | 5 + .emacs.d/mysnippets/text-mode/nxml-mode/h2 | 5 + .emacs.d/mysnippets/text-mode/nxml-mode/h3 | 5 + .emacs.d/mysnippets/text-mode/nxml-mode/h4 | 5 + .emacs.d/mysnippets/text-mode/nxml-mode/h5 | 5 + .emacs.d/mysnippets/text-mode/nxml-mode/h6 | 5 + .emacs.d/mysnippets/text-mode/nxml-mode/head | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/hr | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/href | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/html | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/img | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/input | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/li | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/link | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/meta | 5 + .emacs.d/mysnippets/text-mode/nxml-mode/name | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/ol | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/p | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/pre | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/quote | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/span | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/style | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/table | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/tag.1l | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/tag.2l | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/td | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/th | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/title | 4 + .emacs.d/mysnippets/text-mode/nxml-mode/tr | 6 + .emacs.d/mysnippets/text-mode/nxml-mode/ul | 6 + .emacs.d/mysnippets/text-mode/perl-mode/eval | 8 + .emacs.d/mysnippets/text-mode/perl-mode/for | 5 + .emacs.d/mysnippets/text-mode/perl-mode/fore | 5 + .emacs.d/mysnippets/text-mode/perl-mode/if | 5 + .emacs.d/mysnippets/text-mode/perl-mode/ife | 7 + .emacs.d/mysnippets/text-mode/perl-mode/ifee | 9 + .emacs.d/mysnippets/text-mode/perl-mode/sub | 5 + .emacs.d/mysnippets/text-mode/perl-mode/unless | 5 + .emacs.d/mysnippets/text-mode/perl-mode/while | 5 + .emacs.d/mysnippets/text-mode/perl-mode/xfore | 3 + .emacs.d/mysnippets/text-mode/perl-mode/xif | 3 + .emacs.d/mysnippets/text-mode/perl-mode/xunless | 3 + .emacs.d/mysnippets/text-mode/perl-mode/xwhile | 3 + .emacs.d/mysnippets/text-mode/python-mode/__ | 3 + .emacs.d/mysnippets/text-mode/python-mode/class | 54 + .emacs.d/mysnippets/text-mode/python-mode/def | 35 + .emacs.d/mysnippets/text-mode/python-mode/defm | 33 + .emacs.d/mysnippets/text-mode/python-mode/for | 4 + .emacs.d/mysnippets/text-mode/python-mode/ifmain | 4 + .emacs.d/mysnippets/text-mode/python-mode/prop | 15 + .emacs.d/mysnippets/text-mode/python-mode/propg | 9 + .emacs.d/mysnippets/text-mode/python-mode/propsg | 12 + .emacs.d/mysnippets/text-mode/python-mode/while | 4 + .emacs.d/mysnippets/text-mode/rst-mode/chap | 6 + .emacs.d/mysnippets/text-mode/rst-mode/sec | 6 + .emacs.d/mysnippets/text-mode/rst-mode/tit | 7 + .emacs.d/mysnippets/text-mode/ruby-mode/# | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/=b | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/Comp | 8 + .emacs.d/mysnippets/text-mode/ruby-mode/all | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/am | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/any | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/app | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/bm | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/case | 7 + .emacs.d/mysnippets/text-mode/ruby-mode/cla | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/classify | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/cls | 13 + .emacs.d/mysnippets/text-mode/ruby-mode/collect | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/dee | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/deli | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/det | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/dow | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/ea | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/eac | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/eai | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/eav | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/eawi | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/forin | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/if | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/ife | 8 + .emacs.d/mysnippets/text-mode/ruby-mode/inject | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/mm | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/r | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/rb | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/reject | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/req | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/rreq | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/rw | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/select | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/tim | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/until | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/upt | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/w | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/when | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/while | 6 + .emacs.d/mysnippets/text-mode/ruby-mode/y | 4 + .emacs.d/mysnippets/text-mode/ruby-mode/zip | 4 + .emacs.d/mysnippets/text-mode/scala-mode/act | 10 + .emacs.d/mysnippets/text-mode/scala-mode/act.arg | 10 + .emacs.d/mysnippets/text-mode/scala-mode/actor | 10 + .emacs.d/mysnippets/text-mode/scala-mode/ano | 4 + .emacs.d/mysnippets/text-mode/scala-mode/app | 6 + .emacs.d/mysnippets/text-mode/scala-mode/arr.new | 4 + .../mysnippets/text-mode/scala-mode/arr.val-new | 4 + .emacs.d/mysnippets/text-mode/scala-mode/asof | 4 + .emacs.d/mysnippets/text-mode/scala-mode/ass | 4 + .emacs.d/mysnippets/text-mode/scala-mode/ass.true | 4 + .emacs.d/mysnippets/text-mode/scala-mode/at.author | 4 + .emacs.d/mysnippets/text-mode/scala-mode/at.param | 4 + .emacs.d/mysnippets/text-mode/scala-mode/at.return | 4 + .../mysnippets/text-mode/scala-mode/at.version | 4 + .emacs.d/mysnippets/text-mode/scala-mode/bang | 4 + .emacs.d/mysnippets/text-mode/scala-mode/case | 4 + .../mysnippets/text-mode/scala-mode/case.match-all | 4 + .emacs.d/mysnippets/text-mode/scala-mode/cast | 4 + .emacs.d/mysnippets/text-mode/scala-mode/cc | 4 + .emacs.d/mysnippets/text-mode/scala-mode/cl | 6 + .emacs.d/mysnippets/text-mode/scala-mode/cl.abs | 6 + .../mysnippets/text-mode/scala-mode/cl.abs-arg | 6 + .emacs.d/mysnippets/text-mode/scala-mode/cl.arg | 6 + .emacs.d/mysnippets/text-mode/scala-mode/clof | 4 + .emacs.d/mysnippets/text-mode/scala-mode/co | 4 + .emacs.d/mysnippets/text-mode/scala-mode/cons | 4 + .emacs.d/mysnippets/text-mode/scala-mode/cons.nil | 4 + .emacs.d/mysnippets/text-mode/scala-mode/def.arg | 4 + .../mysnippets/text-mode/scala-mode/def.arg-body | 6 + .../mysnippets/text-mode/scala-mode/def.arg-ret | 4 + .../text-mode/scala-mode/def.arg-ret-body | 6 + .emacs.d/mysnippets/text-mode/scala-mode/def.body | 6 + .emacs.d/mysnippets/text-mode/scala-mode/def.ret | 4 + .../mysnippets/text-mode/scala-mode/def.ret-body | 6 + .../mysnippets/text-mode/scala-mode/def.simple | 4 + .emacs.d/mysnippets/text-mode/scala-mode/doc.class | 8 + .emacs.d/mysnippets/text-mode/scala-mode/doc.def | 6 + .emacs.d/mysnippets/text-mode/scala-mode/doc.file | 9 + .../mysnippets/text-mode/scala-mode/doc.file-scala | 16 + .../text-mode/scala-mode/doc.file-scala-api | 16 + .../mysnippets/text-mode/scala-mode/doc.scaladoc | 7 + .emacs.d/mysnippets/text-mode/scala-mode/expect | 6 + .emacs.d/mysnippets/text-mode/scala-mode/ext | 4 + .../mysnippets/text-mode/scala-mode/for.extract | 4 + .emacs.d/mysnippets/text-mode/scala-mode/for.if | 6 + .emacs.d/mysnippets/text-mode/scala-mode/for.loop | 6 + .emacs.d/mysnippets/text-mode/scala-mode/for.multi | 9 + .emacs.d/mysnippets/text-mode/scala-mode/foreach | 4 + .emacs.d/mysnippets/text-mode/scala-mode/hmap.new | 4 + .../mysnippets/text-mode/scala-mode/hmap.val-new | 4 + .emacs.d/mysnippets/text-mode/scala-mode/hset.new | 4 + .../mysnippets/text-mode/scala-mode/hset.val-new | 4 + .emacs.d/mysnippets/text-mode/scala-mode/if | 6 + .emacs.d/mysnippets/text-mode/scala-mode/if.else | 8 + .emacs.d/mysnippets/text-mode/scala-mode/imp | 4 + .emacs.d/mysnippets/text-mode/scala-mode/intercept | 6 + .emacs.d/mysnippets/text-mode/scala-mode/isof | 4 + .emacs.d/mysnippets/text-mode/scala-mode/ls.new | 4 + .../mysnippets/text-mode/scala-mode/ls.val-new | 4 + .emacs.d/mysnippets/text-mode/scala-mode/main | 6 + .emacs.d/mysnippets/text-mode/scala-mode/map | 4 + .emacs.d/mysnippets/text-mode/scala-mode/map.new | 4 + .emacs.d/mysnippets/text-mode/scala-mode/match | 6 + .emacs.d/mysnippets/text-mode/scala-mode/match.can | 11 + .../mysnippets/text-mode/scala-mode/match.option | 8 + .emacs.d/mysnippets/text-mode/scala-mode/mix | 6 + .emacs.d/mysnippets/text-mode/scala-mode/ob | 4 + .emacs.d/mysnippets/text-mode/scala-mode/pac | 4 + .../mysnippets/text-mode/scala-mode/pr.newline | 4 + .emacs.d/mysnippets/text-mode/scala-mode/pr.simple | 4 + .emacs.d/mysnippets/text-mode/scala-mode/pr.string | 4 + .emacs.d/mysnippets/text-mode/scala-mode/pr.trace | 4 + .emacs.d/mysnippets/text-mode/scala-mode/pri | 4 + .emacs.d/mysnippets/text-mode/scala-mode/pri.param | 4 + .emacs.d/mysnippets/text-mode/scala-mode/pro | 4 + .emacs.d/mysnippets/text-mode/scala-mode/pro.param | 4 + .emacs.d/mysnippets/text-mode/scala-mode/suite | 8 + .emacs.d/mysnippets/text-mode/scala-mode/test | 7 + .emacs.d/mysnippets/text-mode/scala-mode/throw | 4 + .emacs.d/mysnippets/text-mode/scala-mode/tr | 6 + .emacs.d/mysnippets/text-mode/scala-mode/tr.ext | 6 + .../mysnippets/text-mode/scala-mode/tr.ext-with | 6 + .emacs.d/mysnippets/text-mode/scala-mode/tr.with | 6 + .emacs.d/mysnippets/text-mode/scala-mode/try | 9 + .../text-mode/scala-mode/try.catch-finally | 11 + .../mysnippets/text-mode/scala-mode/try.finally | 8 + .emacs.d/mysnippets/text-mode/scala-mode/tup.arrow | 4 + .emacs.d/mysnippets/text-mode/scala-mode/tup.paren | 4 + .emacs.d/mysnippets/text-mode/scala-mode/val | 4 + .emacs.d/mysnippets/text-mode/scala-mode/val.new | 4 + .emacs.d/mysnippets/text-mode/scala-mode/val.ret | 4 + .emacs.d/mysnippets/text-mode/scala-mode/var | 4 + .emacs.d/mysnippets/text-mode/scala-mode/var.new | 4 + .emacs.d/mysnippets/text-mode/scala-mode/var.ret | 4 + .emacs.d/mysnippets/text-mode/scala-mode/whi | 6 + .emacs.d/mysnippets/text-mode/scala-mode/with | 4 + .emacs.d/mysnippets/text-mode/snippet-mode/field | 5 + .emacs.d/mysnippets/text-mode/snippet-mode/mirror | 5 + .emacs.d/mysnippets/text-mode/snippet-mode/vars | 9 + .emacs.d/mysnippets/text-mode/sql-mode/column | 4 + .emacs.d/mysnippets/text-mode/sql-mode/constraint | 4 + .../mysnippets/text-mode/sql-mode/constraint.1 | 4 + .emacs.d/mysnippets/text-mode/sql-mode/create | 10 + .emacs.d/mysnippets/text-mode/sql-mode/create.1 | 12 + .emacs.d/mysnippets/text-mode/sql-mode/references | 4 + .emacs.d/mysnippets/text-mode/time | 3 + 406 files changed, 6050 insertions(+), 44 deletions(-) create mode 100644 .emacs.d/lisp/yasnippet.el create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/c++-mode/beginend create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/c++-mode/class create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/c++-mode/ns create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/c++-mode/template create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/c++-mode/using create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/c-mode/fopen create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/c-mode/printf create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.1 create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/attrib.2 create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/class create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.1 create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.2 create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/comment.3 create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/method create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/namespace create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/prop create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/region create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.1 create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/csharp-mode/using.2 create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/do create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/for create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/if create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/inc create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/inc.1 create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/main create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/objc-mode/prop create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/once create mode 100644 .emacs.d/mysnippets/text-mode/cc-mode/struct create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/bg create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/bg.1 create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/bor create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/cl create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/disp.block create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/disp.inline create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/disp.none create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/ff create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/fs create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/mar.bottom create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/mar.left create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/mar.mar create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/mar.margin create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/mar.right create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/mar.top create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/pad.bottom create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/pad.left create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/pad.pad create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/pad.padding create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/pad.right create mode 100644 .emacs.d/mysnippets/text-mode/css-mode/pad.top create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/.read_me create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/defun create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/dired.process_marked create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.process create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/file.read-lines create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabstring create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/grabthing create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/traverse_dir create mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region create mode 100644 .emacs.d/mysnippets/text-mode/email create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/after create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/begin create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/beh create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/case create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/compile create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/def create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/exp create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/fun create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/if create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/ifdef create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/ifndef create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/imp create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/inc create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/inc.lib create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/loop create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/mod create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/rcv create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/rcv.after create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/rec create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/try create mode 100644 .emacs.d/mysnippets/text-mode/erlang-mode/undef create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/au create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/bd create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/c create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/ch create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/cx create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/dc create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/do create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/dp create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/eq create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/ib create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/ic create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/ich create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/if create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/ii create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/il create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/in create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/inc create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/intr create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/ir create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/l create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/pa create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/pr create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/re create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/st create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/su create mode 100644 .emacs.d/mysnippets/text-mode/f90-mode/wr create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/body create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/br create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/code create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/code.class create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/dd create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/div create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/div.class create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/div.id create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/div.id-class create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/dl create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/dl.id create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/doctype create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/doctype.xhml1 create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_1 create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_strict create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/doctype.xhtml1_transitional create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/dov create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/dt create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/form create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/h1 create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/h2 create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/h3 create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/h4 create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/h5 create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/h6 create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/head create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/hr create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/href create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/html create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/html.xmlns create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/img create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/input create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/li create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/li.class create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/link.stylesheet create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/link.stylesheet-ie create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/mailto create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/meta create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/meta.http-equiv create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/ol create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/ol.class create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/ol.id create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/p create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/pre create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/quote create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/script.javascript create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/script.javascript-src create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/span create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/span.class create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/span.id create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/style create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/table create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/td create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/textarea create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/th create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/title create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/tr create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/ul create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/ul.class create mode 100644 .emacs.d/mysnippets/text-mode/html-mode/ul.id create mode 100644 .emacs.d/mysnippets/text-mode/latex-mode/begin create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/+ create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/- create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/_ create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/__ create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/` create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/h1.1 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/h1.2 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/h2.1 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/h2.2 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/h3 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/h4 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/h5 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/h6 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/hr.1 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/hr.2 create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/img create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/link create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/ol create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/rimg create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/rlb create mode 100644 .emacs.d/mysnippets/text-mode/markdown-mode/rlink create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/body create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/br create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/code create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/div create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/doctype create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_strict create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/doctype.xhtml1_transitional create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/form create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/h1 create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/h2 create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/h3 create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/h4 create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/h5 create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/h6 create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/head create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/hr create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/href create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/html create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/img create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/input create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/li create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/link create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/meta create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/name create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/ol create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/p create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/pre create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/quote create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/span create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/style create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/table create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/tag.1l create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/tag.2l create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/td create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/th create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/title create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/tr create mode 100644 .emacs.d/mysnippets/text-mode/nxml-mode/ul create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/eval create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/for create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/fore create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/if create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/ife create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/ifee create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/sub create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/unless create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/while create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/xfore create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/xif create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/xunless create mode 100644 .emacs.d/mysnippets/text-mode/perl-mode/xwhile create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/__ create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/class create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/def create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/defm create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/for create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/ifmain create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/prop create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/propg create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/propsg create mode 100644 .emacs.d/mysnippets/text-mode/python-mode/while create mode 100644 .emacs.d/mysnippets/text-mode/rst-mode/chap create mode 100644 .emacs.d/mysnippets/text-mode/rst-mode/sec create mode 100644 .emacs.d/mysnippets/text-mode/rst-mode/tit create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/# create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/=b create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/Comp create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/all create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/am create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/any create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/app create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/bm create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/case create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/cla create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/classify create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/cls create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/collect create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/dee create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/deli create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/det create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/dow create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/ea create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/eac create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/eai create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/eav create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/eawi create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/forin create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/if create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/ife create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/inject create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/mm create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/r create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/rb create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/reject create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/req create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/rreq create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/rw create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/select create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/tim create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/until create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/upt create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/w create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/when create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/while create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/y create mode 100644 .emacs.d/mysnippets/text-mode/ruby-mode/zip create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/act create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/act.arg create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/actor create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/ano create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/app create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/arr.new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/arr.val-new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/asof create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/ass create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/ass.true create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/at.author create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/at.param create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/at.return create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/at.version create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/bang create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/case create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/case.match-all create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/cast create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/cc create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/cl create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/cl.abs create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/cl.abs-arg create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/cl.arg create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/clof create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/co create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/cons create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/cons.nil create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/def.arg create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/def.arg-body create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/def.arg-ret-body create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/def.body create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/def.ret create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/def.ret-body create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/def.simple create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/doc.class create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/doc.def create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/doc.file create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/doc.file-scala-api create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/doc.scaladoc create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/expect create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/ext create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/for.extract create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/for.if create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/for.loop create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/for.multi create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/foreach create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/hmap.new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/hmap.val-new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/hset.new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/hset.val-new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/if create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/if.else create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/imp create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/intercept create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/isof create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/ls.new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/ls.val-new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/main create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/map create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/map.new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/match create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/match.can create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/match.option create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/mix create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/ob create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/pac create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/pr.newline create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/pr.simple create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/pr.string create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/pr.trace create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/pri create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/pri.param create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/pro create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/pro.param create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/suite create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/test create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/throw create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/tr create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/tr.ext create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/tr.ext-with create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/tr.with create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/try create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/try.catch-finally create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/try.finally create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/tup.arrow create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/tup.paren create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/val create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/val.new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/val.ret create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/var create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/var.new create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/var.ret create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/whi create mode 100644 .emacs.d/mysnippets/text-mode/scala-mode/with create mode 100644 .emacs.d/mysnippets/text-mode/snippet-mode/field create mode 100644 .emacs.d/mysnippets/text-mode/snippet-mode/mirror create mode 100644 .emacs.d/mysnippets/text-mode/snippet-mode/vars create mode 100644 .emacs.d/mysnippets/text-mode/sql-mode/column create mode 100644 .emacs.d/mysnippets/text-mode/sql-mode/constraint create mode 100644 .emacs.d/mysnippets/text-mode/sql-mode/constraint.1 create mode 100644 .emacs.d/mysnippets/text-mode/sql-mode/create create mode 100644 .emacs.d/mysnippets/text-mode/sql-mode/create.1 create mode 100644 .emacs.d/mysnippets/text-mode/sql-mode/references create mode 100644 .emacs.d/mysnippets/text-mode/time diff --git a/.emacs b/.emacs index b6b1f57..3f7c28b 100644 --- a/.emacs +++ b/.emacs @@ -3,78 +3,70 @@ ;; under X, instead of the default, backspace behavior. (global-set-key [delete] 'delete-char) (global-set-key [kp-delete] 'delete-char) -;;(global-set-key (read-kbd-macro "C-c <") 'end-of-buffer) -(global-set-key [f1] 'comment-region) -(global-set-key [f2] 'uncomment-region) -;;(global-set-key "C-<<" 'end-of-buffer) - ;; My own key bindings ;; ;;(global-set-key [f1] 'compile) -;;(global-set-key [f2] 'delete-other-windows) - ;; Turn on font-lock mode for Emacs (global-font-lock-mode t) +;; custom-set-faces was added by Custom. +;; If you edit it by hand, you could mess it up, so be careful. +;; Your init file should contain only one such instance. +;; If there is more than one, they won't work right. +(custom-set-faces + '(font-lock-comment-face ((nil (:foreground "red"))))) - -;; Always end a file with a newline ;;(setq require-final-newline t) (setq require-final-newline nil) - - -(setq auto-save-default nil) -(setq default-tab-width 4) -(setq make-backup-files nil) +;; Stop at the end of the file, not just add lines +(setq next-line-add-newlines nil) ;; Display columns (setq column-number-mode t) - (setq inhibit-splash-screen t) -;; indent to spaces only -(setq-default indent-tabs-mode nil) - -;; Stop at the end of the file, not just add lines -(setq next-line-add-newlines nil) - - -;; Customized font-lock-comment-face -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(font-lock-comment-face ((nil (:foreground "red"))))) +;; vim-Scroll +(setq scroll-conservatively 1) +;; Various +(setq auto-save-default nil) +(setq make-backup-files nil) -;; Needed in Ubuntu +;; UTF-8 support (legacy workaround for Ubuntu) (set-default-coding-systems 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) -;; vim-Scroll -(setq scroll-conservatively 1) +;; Programming section -;; (require 'pymacs) -;; (pymacs-load "ropemacs" "rope-") -;; (setq ropemacs-enable-autoimport t) +;; Indentation +(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) +;; Default coding style +(setq c-default-style "bsd") -;; (yas/initialize) +;; yasnippet +(yas/initialize) ;; (setq yas/root-directory '("~/.emacs.d/mysnippets" ;; "/usr/share/emacs/site-lisp/yasnippet/snippets")) ;; (mapc 'yas/load-directory yas/root-directory) (yas/load-directory "~/.emacs.d/mysnippets") -(setq c-default-style "bsd" - c-basic-offset 2) +;; Python stuff + +;; Don't attempt to guess the indent +(setq python-indent-guess-indent-offset nil) + +;; (require 'pymacs) +;; (pymacs-load "ropemacs" "rope-") +;; (setq ropemacs-enable-autoimport t) + + +;; CUA mode +;;(cua-mode t) +;;(setq cua-auto-tabify-rectangles nil) +;;(transient-mark-mode 1) +;;(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 @@ +;;; Yasnippet.el --- Yet another snippet extension for Emacs. + +;; Copyright 2008 pluskid +;; 2009 pluskid, joaotavora + +;; Authors: pluskid , joaotavora +;; Version: 0.6.1 +;; Package-version: 0.6.1c +;; X-URL: http://code.google.com/p/yasnippet/ +;; Keywords: convenience, emulation +;; URL: http://code.google.com/p/yasnippet/ +;; EmacsWiki: YaSnippetMode + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Basic steps to setup: +;; +;; 1. In your .emacs file: +;; (add-to-list 'load-path "/dir/to/yasnippet.el") +;; (require 'yasnippet) +;; 2. Place the `snippets' directory somewhere. E.g: ~/.emacs.d/snippets +;; 3. In your .emacs file +;; (setq yas/root-directory "~/.emacs/snippets") +;; (yas/load-directory yas/root-directory) +;; 4. To enable the YASnippet menu and tab-trigger expansion +;; M-x yas/minor-mode +;; 5. To globally enable the minor mode in *all* buffers +;; M-x yas/global-mode +;; +;; Steps 4. and 5. are optional, you don't have to use the minor +;; mode to use YASnippet. +;; +;; Interesting variables are: +;; +;; `yas/root-directory' +;; +;; The directory where user-created snippets are to be +;; stored. Can also be a list of directories that +;; `yas/reload-all' will use for bulk-reloading snippets. In +;; that case the first directory the default for storing new +;; snippets. +;; +;; `yas/mode-symbol' +;; +;; A local variable that you can set in a hook to override +;; snippet-lookup based on major mode. It is a a symbol (or +;; list of symbols) that correspond to subdirectories of +;; `yas/root-directory' and is used for deciding which +;; snippets to consider for the active buffer. +;; +;; Major commands are: +;; +;; M-x yas/expand +;; +;; Try to expand snippets before point. In `yas/minor-mode', +;; this is bound to `yas/trigger-key' which you can customize. +;; +;; M-x yas/load-directory +;; +;; Prompts you for a directory hierarchy of snippets to load. +;; +;; M-x yas/insert-snippet +;; +;; Prompts you for possible snippet expansion if that is +;; possible according to buffer-local and snippet-local +;; expansion conditions. With prefix argument, ignore these +;; conditions. +;; +;; M-x yas/find-snippets +;; +;; Lets you find the snippet files in the correct +;; subdirectory of `yas/root-directory', according to the +;; active major mode (if it exists) like +;; `find-file-other-window'. +;; +;; M-x yas/visit-snippet-file +;; +;; Prompts you for possible snippet expansions like +;; `yas/insert-snippet', but instead of expanding it, takes +;; you directly to the snippet definition's file, if it +;; exists. +;; +;; M-x yas/new-snippet +;; +;; Lets you create a new snippet file in the correct +;; subdirectory of `yas/root-directory', according to the +;; active major mode. +;; +;; M-x yas/load-snippet-buffer +;; +;; When editing a snippet, this loads the snippet. This is +;; bound to "C-c C-c" while in the `snippet-mode' editing +;; mode. +;; +;; M-x yas/tryout-snippet +;; +;; When editing a snippet, this opens a new empty buffer, +;; sets it to the appropriate major mode and inserts the +;; snippet there, so you can see what it looks like. This is +;; bound to "C-c C-t" while in `snippet-mode'. +;; +;; The `dropdown-list.el' extension is bundled with YASnippet, you +;; can optionally use it the preferred "prompting method", puting in +;; your .emacs file, for example: +;; +;; (require 'dropdown-list) +;; (setq yas/prompt-functions '(yas/dropdown-prompt +;; yas/ido-prompt +;; yas/completing-prompt)) +;; +;; Also check out the customization group +;; +;; M-x customize-group RET yasnippet RET +;; +;; If you use the customization group to set variables +;; `yas/root-directory' or `yas/global-mode', make sure the path to +;; "yasnippet.el" is present in the `load-path' *before* the +;; `custom-set-variables' is executed in your .emacs file. +;; +;; For more information and detailed usage, refer to the project page: +;; http://code.google.com/p/yasnippet/ + +;;; Code: + +(require 'cl) +(require 'assoc) +(require 'easymenu) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; User customizable variables + + +(defgroup yasnippet nil + "Yet Another Snippet extension" + :group 'editing) + +;;;###autoload +(defcustom yas/root-directory nil + "Root directory that stores the snippets for each major mode. + +If you set this from your .emacs, can also be a list of strings, +for multiple root directories. If you make this a list, the first +element is always the user-created snippets directory. Other +directories are used for bulk reloading of all snippets using +`yas/reload-all'" + :type '(choice (string :tag "Single directory (string)") + (repeat :args (string) :tag "List of directories (strings)")) + :group 'yasnippet + :require 'yasnippet + :set #'(lambda (symbol new) + (let ((old (and (boundp symbol) + (symbol-value symbol)))) + (set-default symbol new) + (unless (or (not (fboundp 'yas/reload-all)) + (equal old new)) + (yas/reload-all))))) + +(defcustom yas/prompt-functions '(yas/x-prompt + yas/dropdown-prompt + yas/completing-prompt + yas/ido-prompt + yas/no-prompt) + "Functions to prompt for keys, templates, etc interactively. + +These functions are called with the following arguments: + +- PROMPT: A string to prompt the user + +- CHOICES: a list of strings or objects. + +- optional DISPLAY-FN : A function that, when applied to each of +the objects in CHOICES will return a string. + +The return value of any function you put here should be one of +the objects in CHOICES, properly formatted with DISPLAY-FN (if +that is passed). + +- To signal that your particular style of prompting is +unavailable at the moment, you can also have the function return +nil. + +- To signal that the user quit the prompting process, you can +signal `quit' with + + (signal 'quit \"user quit!\")." + :type '(repeat function) + :group 'yasnippet) + +(defcustom yas/indent-line 'auto + "Controls indenting applied to a recent snippet expansion. + +The following values are possible: + +- `fixed' Indent the snippet to the current column; + +- `auto' Indent each line of the snippet with `indent-according-to-mode' + +Every other value means don't apply any snippet-side indendation +after expansion (the manual per-line \"$>\" indentation still +applies)." + :type '(choice (const :tag "Nothing" nothing) + (const :tag "Fixed" fixed) + (const :tag "Auto" auto)) + :group 'yasnippet) + +(defcustom yas/also-auto-indent-first-line nil + "Non-nil means also auto indent first line according to mode. + +Naturally this is only valid when `yas/indent-line' is `auto'" + :type 'boolean + :group 'yasnippet) + +(defcustom yas/snippet-revival t + "Non-nil means re-activate snippet fields after undo/redo." + :type 'boolean + :group 'yasnippet) + +(defcustom yas/trigger-key "TAB" + "The key bound to `yas/expand' when function `yas/minor-mode' is active. + +Value is a string that is converted to the internal Emacs key +representation using `read-kbd-macro'." + :type 'string + :group 'yasnippet + :set #'(lambda (symbol key) + (let ((old (and (boundp symbol) + (symbol-value symbol)))) + (set-default symbol key) + ;; On very first loading of this defcustom, + ;; `yas/trigger-key' is *not* loaded. + (if (fboundp 'yas/trigger-key-reload) + (yas/trigger-key-reload old))))) + +(defcustom yas/next-field-key '("TAB" "") + "The key to navigate to next field when a snippet is active. + +Value is a string that is converted to the internal Emacs key +representation using `read-kbd-macro'. + +Can also be a list of strings." + :type '(choice (string :tag "String") + (repeat :args (string) :tag "List of strings")) + :group 'yasnippet + :set #'(lambda (symbol val) + (set-default symbol val) + (if (fboundp 'yas/init-yas-in-snippet-keymap) + (yas/init-yas-in-snippet-keymap)))) + + +(defcustom yas/prev-field-key '("" "") + "The key to navigate to previous field when a snippet is active. + +Value is a string that is converted to the internal Emacs key +representation using `read-kbd-macro'. + +Can also be a list of strings." + :type '(choice (string :tag "String") + (repeat :args (string) :tag "List of strings")) + :group 'yasnippet + :set #'(lambda (symbol val) + (set-default symbol val) + (if (fboundp 'yas/init-yas-in-snippet-keymap) + (yas/init-yas-in-snippet-keymap)))) + +(defcustom yas/skip-and-clear-key "C-d" + "The key to clear the currently active field. + +Value is a string that is converted to the internal Emacs key +representation using `read-kbd-macro'. + +Can also be a list of strings." + :type '(choice (string :tag "String") + (repeat :args (string) :tag "List of strings")) + :group 'yasnippet + :set #'(lambda (symbol val) + (set-default symbol val) + (if (fboundp 'yas/init-yas-in-snippet-keymap) + (yas/init-yas-in-snippet-keymap)))) + +(defcustom yas/triggers-in-field nil + "If non-nil, `yas/next-field-key' can trigger stacked expansions. + +Otherwise, `yas/next-field-key' just tries to move on to the next +field" + :type 'boolean + :group 'yasnippet) + +(defcustom yas/fallback-behavior 'call-other-command + "How to act when `yas/trigger-key' does *not* expand a snippet. + +- `call-other-command' means try to temporarily disable YASnippet + and call the next command bound to `yas/trigger-key'. + +- nil or the symbol `return-nil' mean do nothing. (and + `yas/expand-returns' nil) + +- A lisp form (apply COMMAND . ARGS) means interactively call + COMMAND, if ARGS is non-nil, call COMMAND non-interactively + with ARGS as arguments." + :type '(choice (const :tag "Call previous command" call-other-command) + (const :tag "Do nothing" return-nil)) + :group 'yasnippet) +(make-variable-buffer-local 'yas/fallback-behavior) + +(defcustom yas/choose-keys-first nil + "If non-nil, prompt for snippet key first, then for template. + +Otherwise prompts for all possible snippet names. + +This affects `yas/insert-snippet' and `yas/visit-snippet-file'." + :type 'boolean + :group 'yasnippet) + +(defcustom yas/choose-tables-first nil + "If non-nil, and multiple eligible snippet tables, prompts user for tables first. + +Otherwise, user chooses between the merging together of all +eligible tables. + +This affects `yas/insert-snippet', `yas/visit-snippet-file'" + :type 'boolean + :group 'yasnippet) + +(defcustom yas/use-menu 'real-modes + "Display a YASnippet menu in the menu bar. + +When non-nil, submenus for each snippet table will be listed +under the menu \"Yasnippet\". + +- If set to `real-modes' only submenus whose name more or less +corresponds to a major mode are listed. + +- If set to `abbreviate', only the current major-mode +menu and the modes set in `yas/mode-symbol' are listed. + +Any other non-nil value, every submenu is listed." + :type '(choice (const :tag "Full" t) + (const :tag "Real modes only" real-modes) + (const :tag "Abbreviate" abbreviate)) + :group 'yasnippet) + +(defcustom yas/trigger-symbol " =>" + "The text that will be used in menu to represent the trigger." + :type 'string + :group 'yasnippet) + +(defcustom yas/wrap-around-region nil + "If non-nil, snippet expansion wraps around selected region. + +The wrapping occurs just before the snippet's exit marker. This +can be overriden on a per-snippet basis." + :type 'boolean + :group 'yasnippet) + +(defcustom yas/good-grace t + "If non-nil, don't raise errors in inline elisp evaluation. + +An error string \"[yas] error\" is returned instead." + :type 'boolean + :group 'yasnippet) + +(defcustom yas/ignore-filenames-as-triggers nil + "If non-nil, don't derive tab triggers from filenames. + +This means a snippet without a \"# key:'\ directive wont have a +tab trigger." + :type 'boolean + :group 'yasnippet) + +(defcustom yas/visit-from-menu nil + "If non-nil visit snippets's files from menu, instead of expanding them. + +This cafn only work when snippets are loaded from files." + :type 'boolean + :group 'yasnippet) + +(defface yas/field-highlight-face + '((((class color) (background light)) (:background "DarkSeaGreen1")) + (t (:background "DimGrey"))) + "The face used to highlight the currently active field of a snippet" + :group 'yasnippet) + +(defface yas/field-debug-face + '() + "The face used for debugging some overlays normally hidden" + :group 'yasnippet) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; User can also customize the next defvars +(defun yas/define-some-keys (keys keymap definition) + "Bind KEYS to DEFINITION in KEYMAP, read with `read-kbd-macro'." + (let ((keys (or (and (listp keys) keys) + (list keys)))) + (dolist (key keys) + (define-key keymap (read-kbd-macro key) definition)))) + +(defvar yas/keymap + (let ((map (make-sparse-keymap))) + (mapc #'(lambda (binding) + (yas/define-some-keys (car binding) map (cdr binding))) + `((,yas/next-field-key . yas/next-field-or-maybe-expand) + (,yas/prev-field-key . yas/prev-field) + ("C-g" . yas/abort-snippet) + (,yas/skip-and-clear-key . yas/skip-and-clear-or-delete-char))) + map) + "The keymap active while a snippet expansion is in progress.") + +(defvar yas/key-syntaxes (list "w" "w_" "w_." "^ ") + "A list of syntax of a key. This list is tried in the order +to try to find a key. For example, if the list is '(\"w\" \"w_\"). +And in emacs-lisp-mode, where \"-\" has the syntax of \"_\": + +foo-bar + +will first try \"bar\", if not found, then \"foo-bar\" is tried.") + +(defvar yas/after-exit-snippet-hook + '() + "Hooks to run after a snippet exited. + +The hooks will be run in an environment where some variables bound to +proper values: + +`yas/snippet-beg' : The beginning of the region of the snippet. + +`yas/snippet-end' : Similar to beg. + +Attention: These hooks are not run when exiting nested/stackd snippet expansion!") + +(defvar yas/before-expand-snippet-hook + '() + "Hooks to run just before expanding a snippet.") + +(defvar yas/buffer-local-condition + '(if (and (not (bobp)) + (or (equal 'font-lock-comment-face + (get-char-property (1- (point)) + 'face)) + (equal 'font-lock-string-face + (get-char-property (1- (point)) + 'face)))) + '(require-snippet-condition . force-in-comment) + t) + "Snippet expanding condition. + +This variable is a lisp form: + + * If it evaluates to nil, no snippets can be expanded. + + * If it evaluates to the a cons (require-snippet-condition + . REQUIREMENT) + + * Snippets bearing no \"# condition:\" directive are not + considered + + * Snippets bearing conditions that evaluate to nil (or + produce an error) won't be onsidered. + + * If the snippet has a condition that evaluates to non-nil + RESULT: + + * If REQUIREMENT is t, the snippet is considered + + * If REQUIREMENT is `eq' RESULT, the snippet is + considered + + * Otherwise, the snippet is not considered. + + * If it evaluates to the symbol 'always, all snippets are + considered for expansion, regardless of any conditions. + + * If it evaluates to t or some other non-nil value + + * Snippet bearing no conditions, or conditions that + evaluate to non-nil, are considered for expansion. + + * Otherwise, the snippet is not considered. + +Here's an example preventing snippets from being expanded from +inside comments, in `python-mode' only, with the exception of +snippets returning the symbol 'force-in-comment in their +conditions. + + (add-hook 'python-mode-hook + '(lambda () + (setq yas/buffer-local-condition + '(if (python-in-string/comment) + '(require-snippet-condition . force-in-comment) + t)))) + +The default value is similar, it filters out potential snippet +expansions inside comments and string literals, unless the +snippet itself contains a condition that returns the symbol +`force-in-comment'.") +(make-variable-buffer-local 'yas/buffer-local-condition) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Internal variables + +(defvar yas/version "0.6.1b") + +(defvar yas/menu-table (make-hash-table) + "A hash table of MAJOR-MODE symbols to menu keymaps.") + +(defvar yas/active-keybindings nil + "A list of cons (KEYMAP . KEY) setup from defining snippets.") + +(defvar yas/known-modes + '(ruby-mode rst-mode markdown-mode) + "A list of mode which is well known but not part of emacs.") + +(defvar yas/escaped-characters + '(?\\ ?` ?' ?$ ?} ) + "List of characters which *might* need to be escaped.") + +(defconst yas/field-regexp + "${\\([0-9]+:\\)?\\([^}]*\\)}" + "A regexp to *almost* recognize a field.") + +(defconst yas/multi-dollar-lisp-expression-regexp + "$+[ \t\n]*\\(([^)]*)\\)" + "A regexp to *almost* recognize a \"$(...)\" expression.") + +(defconst yas/backquote-lisp-expression-regexp + "`\\([^`]*\\)`" + "A regexp to recognize a \"`lisp-expression`\" expression." ) + +(defconst yas/transform-mirror-regexp + "${\\(?:\\([0-9]+\\):\\)?$\\([ \t\n]*([^}]*\\)" + "A regexp to *almost* recognize a mirror with a transform.") + +(defconst yas/simple-mirror-regexp + "$\\([0-9]+\\)" + "A regexp to recognize a simple mirror.") + +(defvar yas/snippet-id-seed 0 + "Contains the next id for a snippet.") + +(defun yas/snippet-next-id () + (let ((id yas/snippet-id-seed)) + (incf yas/snippet-id-seed) + id)) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Minor mode stuff + +;; XXX: `last-buffer-undo-list' is somehow needed in Carbon Emacs for MacOSX +(defvar last-buffer-undo-list nil) + +(defvar yas/minor-mode-menu nil + "Holds the YASnippet menu") + +(defun yas/init-minor-keymap () + (let ((map (make-sparse-keymap))) + (easy-menu-define yas/minor-mode-menu + map + "Menu used when YAS/minor-mode is active." + '("YASnippet" + "----" + ["Expand trigger" yas/expand + :help "Possibly expand tab trigger before point"] + ["Insert at point..." yas/insert-snippet + :help "Prompt for an expandable snippet and expand it at point"] + ["New snippet..." yas/new-snippet + :help "Create a new snippet in an appropriate directory"] + ["Visit snippet file..." yas/visit-snippet-file + :help "Prompt for an expandable snippet and find its file"] + ["Find snippets..." yas/find-snippets + :help "Invoke `find-file' in the appropriate snippet directory"] + "----" + ("Snippet menu behaviour" + ["Visit snippets" (setq yas/visit-from-menu t) + :help "Visit snippets from the menu" + :active t :style radio :selected yas/visit-from-menu] + ["Expand snippets" (setq yas/visit-from-menu nil) + :help "Expand snippets from the menu" + :active t :style radio :selected (not yas/visit-from-menu)] + "----" + ["Show \"Real\" modes only" (setq yas/use-menu 'real-modes) + :help "Show snippet submenus for modes that appear to be real major modes" + :active t :style radio :selected (eq yas/use-menu 'real-modes)] + ["Show all modes" (setq yas/use-menu 't) + :help "Show one snippet submenu for each loaded table" + :active t :style radio :selected (eq yas/use-menu 't)] + ["Abbreviate according to current mode" (setq yas/use-menu 'abbreviate) + :help "Show only snippet submenus for the current active modes" + :active t :style radio :selected (eq yas/use-menu 'abbreviate)]) + ("Indenting" + ["Auto" (setq yas/indent-line 'auto) + :help "Indent each line of the snippet with `indent-according-to-mode'" + :active t :style radio :selected (eq yas/indent-line 'auto)] + ["Fixed" (setq yas/indent-line 'fixed) + :help "Indent the snippet to the current column" + :active t :style radio :selected (eq yas/indent-line 'fixed)] + ["None" (setq yas/indent-line 'none) + :help "Don't apply any particular snippet indentation after expansion" + :active t :style radio :selected (not (member yas/indent-line '(fixed auto)))] + "----" + ["Also auto indent first line" (setq yas/also-auto-indent-first-line + (not yas/also-auto-indent-first-line)) + :help "When auto-indenting also, auto indent the first line menu" + :active (eq yas/indent-line 'auto) + :style toggle :selected yas/also-auto-indent-first-line] + ) + ("Prompting method" + ["System X-widget" (setq yas/prompt-functions + (cons 'yas/x-prompt + (remove 'yas/x-prompt + yas/prompt-functions))) + :help "Use your windowing system's (gtk, mac, windows, etc...) default menu" + :active t :style radio :selected (eq (car yas/prompt-functions) + 'yas/x-prompt)] + ["Dropdown-list" (setq yas/prompt-functions + (cons 'yas/dropdown-prompt + (remove 'yas/dropdown-prompt + yas/prompt-functions))) + :help "Use a special dropdown list" + :active t :style radio :selected (eq (car yas/prompt-functions) + 'yas/dropdown-prompt)] + ["Ido" (setq yas/prompt-functions + (cons 'yas/ido-prompt + (remove 'yas/ido-prompt + yas/prompt-functions))) + :help "Use an ido-style minibuffer prompt" + :active t :style radio :selected (eq (car yas/prompt-functions) + 'yas/ido-prompt)] + ["Completing read" (setq yas/prompt-functions + (cons 'yas/completing-prompt + (remove 'yas/completing-prompt-prompt + yas/prompt-functions))) + :help "Use a normal minibuffer prompt" + :active t :style radio :selected (eq (car yas/prompt-functions) + 'yas/completing-prompt-prompt)] + ) + ("Misc" + ["Wrap region in exit marker" + (setq yas/wrap-around-region + (not yas/wrap-around-region)) + :help "If non-nil automatically wrap the selected text in the $0 snippet exit" + :style toggle :selected yas/wrap-around-region] + ["Allow stacked expansions " + (setq yas/triggers-in-field + (not yas/triggers-in-field)) + :help "If non-nil allow snippets to be triggered inside other snippet fields" + :style toggle :selected yas/triggers-in-field] + ["Revive snippets on undo " + (setq yas/snippet-revival + (not yas/snippet-revival)) + :help "If non-nil allow snippets to become active again after undo" + :style toggle :selected yas/snippet-revival] + ["Good grace " + (setq yas/good-grace + (not yas/good-grace)) + :help "If non-nil don't raise errors in bad embedded eslip in snippets" + :style toggle :selected yas/good-grace] + ["Ignore filenames as triggers" + (setq yas/ignore-filenames-as-triggers + (not yas/ignore-filenames-as-triggers)) + :help "If non-nil don't derive tab triggers from filenames" + :style toggle :selected yas/ignore-filenames-as-triggers] + ) + "----" + ["Load snippets..." yas/load-directory + :help "Load snippets from a specific directory"] + ["Reload everything" yas/reload-all + :help "Cleanup stuff, reload snippets, rebuild menus"] + ["About" yas/about + :help "Display some information about YASsnippet"])) + ;; Now for the stuff that has direct keybindings + ;; + (define-key map "\C-c&\C-s" 'yas/insert-snippet) + (define-key map "\C-c&\C-n" 'yas/new-snippet) + (define-key map "\C-c&\C-v" 'yas/visit-snippet-file) + (define-key map "\C-c&\C-f" 'yas/find-snippets) + map)) + +(defvar yas/minor-mode-map (yas/init-minor-keymap) + "The keymap used when `yas/minor-mode' is active.") + +(defun yas/trigger-key-reload (&optional unbind-key) + "Rebind `yas/expand' to the new value of `yas/trigger-key'. + +With optional UNBIND-KEY, try to unbind that key from +`yas/minor-mode-map'." + (when (and unbind-key + (stringp unbind-key) + (not (string= unbind-key ""))) + (define-key yas/minor-mode-map (read-kbd-macro unbind-key) nil)) + (when (and yas/trigger-key + (stringp yas/trigger-key) + (not (string= yas/trigger-key ""))) + (define-key yas/minor-mode-map (read-kbd-macro yas/trigger-key) 'yas/expand))) + +;;;###autoload +(define-minor-mode yas/minor-mode + "Toggle YASnippet mode. + +When YASnippet mode is enabled, the `tas/trigger-key' key expands +snippets of code depending on the mode. + +With no argument, this command toggles the mode. +positive prefix argument turns on the mode. +Negative prefix argument turns off the mode. + +You can customize the key through `yas/trigger-key'. + +Key bindings: +\\{yas/minor-mode-map}" + nil + ;; The indicator for the mode line. + " yas" + :group 'yasnippet + (when yas/minor-mode + (yas/trigger-key-reload) + ;; load all snippets definitions unless we still don't have a + ;; root-directory or some snippets have already been loaded. + (unless (or (null yas/root-directory) + (> (hash-table-count yas/snippet-tables) 0)) + (yas/reload-all)))) + +(defvar yas/dont-activate #'(lambda () + (and yas/root-directory + (null (yas/get-snippet-tables)))) + "If non-nil don't let `yas/minor-mode-on' active yas for this buffer. + +`yas/minor-mode-on' is usually called by `yas/global-mode' so +this effectively lets you define exceptions to the \"global\" +behaviour.") +(make-variable-buffer-local 'yas/dont-activate) + + +(defun yas/minor-mode-on () + "Turn on YASnippet minor mode. + +Do this unless `yas/dont-activate' is t or the function +`yas/get-snippet-tables' (which see), returns an empty list." + (interactive) + (unless (or (and (functionp yas/dont-activate) + (funcall yas/dont-activate)) + (and (not (functionp yas/dont-activate)) + yas/dont-activate)) + (yas/minor-mode 1))) + +(defun yas/minor-mode-off () + "Turn off YASnippet minor mode." + (interactive) + (yas/minor-mode -1)) + +(define-globalized-minor-mode yas/global-mode yas/minor-mode yas/minor-mode-on + :group 'yasnippet + :require 'yasnippet) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Major mode stuff +;; +(defvar yas/font-lock-keywords + (append '(("^#.*$" . font-lock-comment-face)) + lisp-font-lock-keywords + lisp-font-lock-keywords-1 + lisp-font-lock-keywords-2 + '(("$\\([0-9]+\\)" + (0 font-lock-keyword-face) + (1 font-lock-string-face t)) + ("${\\([0-9]+\\):?" + (0 font-lock-keyword-face) + (1 font-lock-warning-face t)) + ("${" font-lock-keyword-face) + ("$[0-9]+?" font-lock-preprocessor-face) + ("\\(\\$(\\)" 1 font-lock-preprocessor-face) + ("}" + (0 font-lock-keyword-face))))) + +(defun yas/init-major-keymap () + (let ((map (make-sparse-keymap))) + (easy-menu-define nil + map + "Menu used when snippet-mode is active." + (cons "Snippet" + (mapcar #'(lambda (ent) + (when (third ent) + (define-key map (third ent) (second ent))) + (vector (first ent) (second ent) t)) + (list + (list "Load this snippet" 'yas/load-snippet-buffer "\C-c\C-c") + (list "Try out this snippet" 'yas/tryout-snippet "\C-c\C-t"))))) + map)) + +(defvar snippet-mode-map + (yas/init-major-keymap) + "The keymap used when `snippet-mode' is active") + + +(define-derived-mode snippet-mode text-mode "Snippet" + "A mode for editing yasnippets" + (set-syntax-table (standard-syntax-table)) + (setq font-lock-defaults '(yas/font-lock-keywords)) + (set (make-local-variable 'require-final-newline) nil) + (use-local-map snippet-mode-map)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Internal structs for template management + +(defstruct (yas/template (:constructor yas/make-template + (content name condition expand-env file keybinding))) + "A template for a snippet." + content + name + condition + expand-env + file + keybinding) + +(defvar yas/snippet-tables (make-hash-table) + "A hash table of MAJOR-MODE symbols to `yas/snippet-table' objects.") + +(defstruct (yas/snippet-table (:constructor yas/make-snippet-table (name))) + "A table to store snippets for a particular mode. + +Has the following fields: + +`yas/snippet-table-name' + + A symbol normally corresponding to a major mode, but can also be + a pseudo major-mode to be referenced in `yas/mode-symbol', for + example. + +`yas/snippet-table-hash' + + A hash table the key is a string (the snippet key) and the + value is yet another hash of (NAME TEMPLATE), where NAME is the + snippet name and TEMPLATE is a `yas/template' object name. + +`yas/snippet-table-parents' + + A list of tables considered parents of this table: i.e. when + searching for expansions they are searched as well." + name + (hash (make-hash-table :test 'equal)) + (parents nil)) + +(defvar yas/better-guess-for-replacements nil + "If non-nil `yas/store' better guess snippet replacements.") + +(defun yas/store (table name key template) + "Store a snippet template in the TABLE." + + ;; This is dones by searching twice: + ;; + ;; * Try to get the existing namehash from TABLE using key. + ;; + ;; * Try to get the existing namehash from by searching the *whole* + ;; snippet table for NAME. This is becuase they user might have + ;; changed the key and that can no longer be used to locate the + ;; previous `yas/template-structure'. + ;; + ;; * If that returns nothing, oh well... + ;; + (dolist (existing-namehash (remove nil (list (gethash key (yas/snippet-table-hash table)) + (when yas/better-guess-for-replacements + (let (a) + (maphash #'(lambda (key namehash) + (when (gethash name namehash) + (setq a namehash))) + (yas/snippet-table-hash table)) + a))))) + (let ((existing-template (gethash name existing-namehash))) + (when existing-template + ;; Remove the existing keybinding + (when (yas/template-keybinding existing-template) + (define-key + (symbol-value (first (yas/template-keybinding existing-template))) + (second (yas/template-keybinding existing-template)) + nil) + (setq yas/active-keybindings + (delete (yas/template-keybinding existing-template) + yas/active-keybindings))) + ;; Remove the (name . template) mapping from existing-namehash. + (remhash name existing-namehash)))) + ;; Now store the new template independent of the previous steps. + ;; + (puthash name + template + (or (gethash key + (yas/snippet-table-hash table)) + (puthash key + (make-hash-table :test 'equal) + (yas/snippet-table-hash table))))) + +(defun yas/fetch (table key) + "Fetch a snippet binding to KEY from TABLE." + (let* ((keyhash (yas/snippet-table-hash table)) + (namehash (and keyhash (gethash key keyhash)))) + (when namehash + (yas/filter-templates-by-condition + (let (alist) + (maphash #'(lambda (k v) + (push (cons k v) alist)) + namehash) + alist))))) + + +;; Filtering/condition logic + +(defun yas/eval-condition (condition) + (condition-case err + (save-excursion + (save-restriction + (save-match-data + (eval condition)))) + (error (progn + (message (format "[yas] error in condition evaluation: %s" + (error-message-string err))) + nil)))) + + +(defun yas/filter-templates-by-condition (templates) + "Filter the templates using the applicable condition. + +TEMPLATES is a list of cons (NAME . TEMPLATE) where NAME is a +string and TEMPLATE is a `yas/template' structure. + +This function implements the rules described in +`yas/buffer-local-condition'. See that variables documentation." + (let ((requirement (yas/require-template-specific-condition-p))) + (if (eq requirement 'always) + templates + (remove-if-not #'(lambda (pair) + (yas/template-can-expand-p (yas/template-condition (cdr pair)) requirement)) + templates)))) + +(defun yas/require-template-specific-condition-p () + "Decides if this buffer requests/requires snippet-specific +conditions to filter out potential expansions." + (if (eq 'always yas/buffer-local-condition) + 'always + (let ((local-condition (or (and (consp yas/buffer-local-condition) + (yas/eval-condition yas/buffer-local-condition)) + yas/buffer-local-condition))) + (when local-condition + (if (eq local-condition t) + t + (and (consp local-condition) + (eq 'require-snippet-condition (car local-condition)) + (symbolp (cdr local-condition)) + (cdr local-condition))))))) + +(defun yas/template-can-expand-p (condition &optional requirement) + "Evaluates CONDITION and REQUIREMENT and returns a boolean" + (let* ((requirement (or requirement + (yas/require-template-specific-condition-p))) + (result (or (null condition) + (yas/eval-condition + (condition-case err + (read condition) + (error (progn + (message (format "[yas] error reading condition: %s" + (error-message-string err)))) + nil)))))) + (cond ((eq requirement t) + result) + (t + (eq requirement result))))) + +(defun yas/snippet-table-get-all-parents (table) + (let ((parents (yas/snippet-table-parents table))) + (when parents + (append (copy-list parents) + (mapcan #'yas/snippet-table-get-all-parents parents))))) + +(defun yas/snippet-table-templates (table) + (when table + (let ((acc (list))) + (maphash #'(lambda (key namehash) + (maphash #'(lambda (name template) + (push (cons name template) acc)) + namehash)) + (yas/snippet-table-hash table)) + (yas/filter-templates-by-condition acc)))) + +(defun yas/current-key () + "Get the key under current position. A key is used to find +the template of a snippet in the current snippet-table." + (let ((start (point)) + (end (point)) + (syntaxes yas/key-syntaxes) + syntax + done + templates) + (while (and (not done) syntaxes) + (setq syntax (car syntaxes)) + (setq syntaxes (cdr syntaxes)) + (save-excursion + (skip-syntax-backward syntax) + (setq start (point))) + (setq templates + (mapcan #'(lambda (table) + (yas/fetch table (buffer-substring-no-properties start end))) + (yas/get-snippet-tables))) + (if templates + (setq done t) + (setq start end))) + (list templates + start + end))) + + +(defun yas/snippet-table-all-keys (table) + (when table + (let ((acc)) + (maphash #'(lambda (key templates) + (when (yas/filter-templates-by-condition templates) + (push key acc))) + (yas/snippet-table-hash table)) + acc))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Internal functions + +(defun yas/real-mode? (mode) + "Try to find out if MODE is a real mode. The MODE bound to +a function (like `c-mode') is considered real mode. Other well +known mode like `ruby-mode' which is not part of Emacs might +not bound to a function until it is loaded. So yasnippet keeps +a list of modes like this to help the judgement." + (or (fboundp mode) + (find mode yas/known-modes))) + +(defun yas/read-and-eval-string (string) + ;; TODO: This is a possible optimization point, the expression could + ;; be stored in cons format instead of string, + "Evaluate STRING and convert the result to string." + (let ((retval (catch 'yas/exception + (condition-case err + (save-excursion + (save-restriction + (save-match-data + (widen) + (let ((result (eval (read string)))) + (when result + (format "%s" result)))))) + (error (if yas/good-grace + "[yas] elisp error!" + (error (format "[yas] elisp error: %s" + (error-message-string err))))))))) + (when (and (consp retval) + (eq 'yas/exception (car retval))) + (error (cdr retval))) + retval)) + +(defvar yas/mode-symbol nil + "If non-nil, lookup snippets using this instead of `major-mode'.") +(make-variable-buffer-local 'yas/mode-symbol) + +(defun yas/snippet-table-get-create (mode) + "Get the snippet table corresponding to MODE. + +Optional DIRECTORY gets recorded as the default directory to +search for snippet files if the retrieved/created table didn't +already have such a property." + (let ((table (gethash mode + yas/snippet-tables))) + (unless table + (setq table (yas/make-snippet-table (symbol-name mode))) + (puthash mode table yas/snippet-tables)) + table)) + +(defun yas/get-snippet-tables (&optional mode-symbol dont-search-parents) + "Get snippet tables for current buffer. + +Return a list of 'yas/snippet-table' objects indexed by mode. + +The modes are tried in this order: optional MODE-SYMBOL, then +`yas/mode-symbol', then `major-mode' then, unless +DONT-SEARCH-PARENTS is non-nil, the guessed parent mode of either +MODE-SYMBOL or `major-mode'. + +Guessing is done by looking up the MODE-SYMBOL's +`derived-mode-parent' property, see also `derived-mode-p'." + (let ((mode-tables + (mapcar #'(lambda (mode) + (gethash mode yas/snippet-tables)) + (append (list mode-symbol) + (if (listp yas/mode-symbol) + yas/mode-symbol + (list yas/mode-symbol)) + (list major-mode + (and (not dont-search-parents) + (get (or mode-symbol major-mode) + 'derived-mode-parent)))))) + (all-tables)) + (dolist (table (remove nil mode-tables)) + (push table all-tables) + (nconc all-tables (yas/snippet-table-get-all-parents table))) + (remove-duplicates all-tables))) + +(defun yas/menu-keymap-get-create (mode) + "Get the menu keymap correspondong to MODE." + (or (gethash mode yas/menu-table) + (puthash mode (make-sparse-keymap) yas/menu-table))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Template-related and snippet loading functions + +(defun yas/parse-template (&optional file) + "Parse the template in the current buffer. + +Optional FILE is the absolute file name of the file being +parsed. + +Return a snippet-definition, i.e. a list + + (KEY TEMPLATE NAME CONDITION GROUP VARS FILE KEYBINDING) + +If the buffer contains a line of \"# --\" then the contents +above this line are ignored. Variables can be set above this +line through the syntax: + +#name : value + +Here's a list of currently recognized variables: + + * name + * contributor + * condition + * key + * group + * expand-env + +#name: #include \"...\" +# -- +#include \"$1\"" + ;; + ;; + (goto-char (point-min)) + (let* ((name (and file + (file-name-nondirectory file))) + (key (unless yas/ignore-filenames-as-triggers + (and name + (file-name-sans-extension name)))) + template + bound + condition + (group (and file + (yas/calculate-group file))) + expand-env + binding) + (if (re-search-forward "^# --\n" nil t) + (progn (setq template + (buffer-substring-no-properties (point) + (point-max))) + (setq bound (point)) + (goto-char (point-min)) + (while (re-search-forward "^# *\\([^ ]+?\\) *: *\\(.*\\)$" bound t) + (when (string= "name" (match-string-no-properties 1)) + (setq name (match-string-no-properties 2))) + (when (string= "condition" (match-string-no-properties 1)) + (setq condition (match-string-no-properties 2))) + (when (string= "group" (match-string-no-properties 1)) + (setq group (match-string-no-properties 2))) + (when (string= "expand-env" (match-string-no-properties 1)) + (setq expand-env (match-string-no-properties 2))) + (when (string= "key" (match-string-no-properties 1)) + (setq key (match-string-no-properties 2))) + (when (string= "binding" (match-string-no-properties 1)) + (setq binding (match-string-no-properties 2))))) + (setq template + (buffer-substring-no-properties (point-min) (point-max)))) + (list key template name condition group expand-env file binding))) + +(defun yas/calculate-group (file) + "Calculate the group for snippet file path FILE." + (let* ((dominating-dir (locate-dominating-file file + ".yas-make-groups")) + (extra-path (and dominating-dir + (replace-regexp-in-string (concat "^" + (expand-file-name dominating-dir)) + "" + (expand-file-name file)))) + (extra-dir (and extra-path + (file-name-directory extra-path))) + (group (and extra-dir + (replace-regexp-in-string "/" + "." + (directory-file-name extra-dir))))) + group)) + +;; (defun yas/glob-files (directory &optional recurse-p append) +;; "Returns files under DIRECTORY ignoring dirs and hidden files. + +;; If RECURSE in non-nil, do that recursively." +;; (let (ret +;; (default-directory directory)) +;; (dolist (entry (directory-files ".")) +;; (cond ((or (string-match "^\\." +;; (file-name-nondirectory entry)) +;; (string-match "~$" +;; (file-name-nondirectory entry))) +;; nil) +;; ((and recurse-p +;; (file-directory-p entry)) +;; (setq ret (nconc ret +;; (yas/glob-files (expand-file-name entry) +;; recurse-p +;; (if append +;; (concat append "/" entry) +;; entry))))) +;; ((file-directory-p entry) +;; nil) +;; (t +;; (push (if append +;; (concat append "/" entry) +;; entry) ret)))) +;; ret)) + +(defun yas/subdirs (directory &optional file?) + "Return subdirs or files of DIRECTORY according to FILE?." + (remove-if (lambda (file) + (or (string-match "^\\." + (file-name-nondirectory file)) + (string-match "~$" + (file-name-nondirectory file)) + (if file? + (file-directory-p file) + (not (file-directory-p file))))) + (directory-files directory t))) + +(defun yas/make-menu-binding (template) + `(lambda () (interactive) (yas/expand-or-visit-from-menu ,template))) + +(defun yas/expand-or-visit-from-menu (template) + (if yas/visit-from-menu + (yas/visit-snippet-file-1 template) + (let ((where (if mark-active + (cons (region-beginning) (region-end)) + (cons (point) (point))))) + (yas/expand-snippet (yas/template-content template) + (car where) + (cdr where))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Popping up for keys and templates +;; +(defun yas/prompt-for-template (templates &optional prompt) + "Interactively choose a template from the list TEMPLATES. + +TEMPLATES is a list of `yas/template'." + (when templates + (some #'(lambda (fn) + (funcall fn (or prompt "Choose a snippet: ") + templates + #'yas/template-name)) + yas/prompt-functions))) + +(defun yas/prompt-for-keys (keys &optional prompt) + "Interactively choose a template key from the list KEYS." + (when keys + (some #'(lambda (fn) + (funcall fn (or prompt "Choose a snippet key: ") keys)) + yas/prompt-functions))) + +(defun yas/prompt-for-table (tables &optional prompt) + (when tables + (some #'(lambda (fn) + (funcall fn (or prompt "Choose a snippet table: ") + tables + #'yas/snippet-table-name)) + yas/prompt-functions))) + +(defun yas/x-prompt (prompt choices &optional display-fn) + (when (and window-system choices) + (let ((keymap (cons 'keymap + (cons + prompt + (mapcar (lambda (choice) + (list choice + 'menu-item + (if display-fn + (funcall display-fn choice) + choice) + t)) + choices))))) + (when (cdr keymap) + (car (x-popup-menu (if (fboundp 'posn-at-point) + (let ((x-y (posn-x-y (posn-at-point (point))))) + (list (list (+ (car x-y) 10) + (+ (cdr x-y) 20)) + (selected-window))) + t) + keymap)))))) + +(defun yas/ido-prompt (prompt choices &optional display-fn) + (when (and (featurep 'ido) + ido-mode) + (let* ((formatted-choices (or (and display-fn + (mapcar display-fn choices)) + choices)) + (chosen (and formatted-choices + (ido-completing-read prompt + formatted-choices + nil + 'require-match + nil + nil)))) + (when chosen + (nth (position chosen formatted-choices :test #'string=) choices))))) + +(eval-when-compile (require 'dropdown-list nil t)) +(defun yas/dropdown-prompt (prompt choices &optional display-fn) + (when (featurep 'dropdown-list) + (let* ((formatted-choices (or (and display-fn + (mapcar display-fn choices)) + choices)) + (chosen (and formatted-choices + (nth (dropdown-list formatted-choices) + choices)))) + chosen))) + +(defun yas/completing-prompt (prompt choices &optional display-fn) + (let* ((formatted-choices (or (and display-fn + (mapcar display-fn choices)) + choices)) + (chosen (and formatted-choices + (completing-read prompt + formatted-choices + nil + 'require-match + nil + nil)))) + (when chosen + (nth (position chosen formatted-choices :test #'string=) choices)))) + +(defun yas/no-prompt (prompt choices &optional display-fn) + (first choices)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Loading snippets from files +;; +(defun yas/load-directory-1 (directory &optional parents no-hierarchy-parents making-groups-sym) + "Recursively load snippet templates from DIRECTORY." + ;; TODO: Rewrite this horrible, horrible monster I created + (unless (file-exists-p (concat directory "/" ".yas-skip")) + (let* ((major-mode-and-parents (unless making-groups-sym + (yas/compute-major-mode-and-parents (concat directory "/dummy") + nil + no-hierarchy-parents))) + (yas/ignore-filenames-as-triggers (or yas/ignore-filenames-as-triggers + (file-exists-p (concat directory "/" ".yas-ignore-filenames-as-triggers")))) + (mode-sym (and major-mode-and-parents + (car major-mode-and-parents))) + (parents (if making-groups-sym + parents + (rest major-mode-and-parents))) + (snippet-defs nil) + (make-groups-p (or making-groups-sym + (file-exists-p (concat directory "/" ".yas-make-groups"))))) + (with-temp-buffer + (dolist (file (yas/subdirs directory 'no-subdirs-just-files)) + (when (file-readable-p file) + (insert-file-contents file nil nil nil t) + (push (yas/parse-template file) + snippet-defs)))) + (yas/define-snippets (or mode-sym + making-groups-sym) + snippet-defs + parents) + (dolist (subdir (yas/subdirs directory)) + (if make-groups-p + (yas/load-directory-1 subdir parents 't (or mode-sym + making-groups-sym)) + (yas/load-directory-1 subdir (list mode-sym))))))) + +(defun yas/load-directory (directory) + "Load snippet definition from a directory hierarchy. + +Below the top-level directory, each directory is a mode +name. And under each subdirectory, each file is a definition +of a snippet. The file name is the trigger key and the +content of the file is the template." + (interactive "DSelect the root directory: ") + (unless (file-directory-p directory) + (error "Error %s not a directory" directory)) + (unless yas/root-directory + (setq yas/root-directory directory)) + (dolist (dir (yas/subdirs directory)) + (yas/load-directory-1 dir nil 'no-hierarchy-parents)) + (when (interactive-p) + (message "done."))) + +(defun yas/kill-snippet-keybindings () + "Remove the all active snippet keybindings." + (interactive) + (dolist (keybinding yas/active-keybindings) + (define-key (symbol-value (first keybinding)) (second keybinding) nil)) + (setq yas/active-keybindings nil)) + +(defun yas/reload-all (&optional reset-root-directory) + "Reload all snippets and rebuild the YASnippet menu. " + (interactive "P") + ;; Turn off global modes and minor modes, save their state though + ;; + (let ((restore-global-mode (prog1 yas/global-mode + (yas/global-mode -1))) + (restore-minor-mode (prog1 yas/minor-mode + (yas/minor-mode -1)))) + ;; Empty all snippet tables and all menu tables + ;; + (setq yas/snippet-tables (make-hash-table)) + (setq yas/menu-table (make-hash-table)) + + ;; Init the `yas/minor-mode-map', taking care not to break the + ;; menu.... + ;; + (setf (cdr yas/minor-mode-map) + (cdr (yas/init-minor-keymap))) + + ;; Now, clean up the other keymaps we might have cluttered up. + (yas/kill-snippet-keybindings) + + (when reset-root-directory + (setq yas/root-directory nil)) + + ;; Reload the directories listed in `yas/root-directory' or prompt + ;; the user to select one. + ;; + (if yas/root-directory + (if (listp yas/root-directory) + (dolist (directory yas/root-directory) + (yas/load-directory directory)) + (yas/load-directory yas/root-directory)) + (call-interactively 'yas/load-directory)) + + ;; Restore the mode configuration + ;; + (when restore-minor-mode + (yas/minor-mode 1)) + (when restore-global-mode + (yas/global-mode 1)) + + (message "[yas] Reloading everything... Done."))) + +(defun yas/quote-string (string) + "Escape and quote STRING. +foo\"bar\\! -> \"foo\\\"bar\\\\!\"" + (concat "\"" + (replace-regexp-in-string "[\\\"]" + "\\\\\\&" + string + t) + "\"")) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Yasnippet Bundle + +(defun yas/initialize () + "For backward compatibility, enable `yas/minor-mode' globally" + (yas/global-mode 1)) + +(defun yas/compile-bundle + (&optional yasnippet yasnippet-bundle snippet-roots code dropdown) + "Compile snippets in SNIPPET-ROOTS to a single bundle file. + +YASNIPPET is the yasnippet.el file path. + +YASNIPPET-BUNDLE is the output file of the compile result. + +SNIPPET-ROOTS is a list of root directories that contains the +snippets definition. + +CODE is the code to be placed at the end of the generated file +and that can initialize the YASnippet bundle. + +Last optional argument DROPDOWN is the filename of the +dropdown-list.el library. + +Here's the default value for all the parameters: + + (yas/compile-bundle \"yasnippet.el\" + \"yasnippet-bundle.el\" + \"snippets\") + \"(yas/initialize-bundle) + ### autoload + (require 'yasnippet-bundle)`\" + \"dropdown-list.el\") +" + (interactive "ffind the yasnippet.el file: \nFTarget bundle file: \nDSnippet directory to bundle: \nMExtra code? \nfdropdown-library: ") + + (let* ((yasnippet (or yasnippet + "yasnippet.el")) + (yasnippet-bundle (or yasnippet-bundle + "./yasnippet-bundle.el")) + (snippet-roots (or snippet-roots + "snippets")) + (dropdown (or dropdown + "dropdown-list.el")) + (code (or (and code + (condition-case err (read code) (error nil)) + code) + (concat "(yas/initialize-bundle)" + "\n;;;###autoload" ; break through so that won't + "(require 'yasnippet-bundle)"))) + (dirs (or (and (listp snippet-roots) snippet-roots) + (list snippet-roots))) + (bundle-buffer nil)) + (with-temp-file yasnippet-bundle + (insert ";;; yasnippet-bundle.el --- " + "Yet another snippet extension (Auto compiled bundle)\n") + (insert-file-contents yasnippet) + (goto-char (point-max)) + (insert "\n") + (when dropdown + (insert-file-contents dropdown)) + (goto-char (point-max)) + (insert ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n") + (insert ";;;; Auto-generated code ;;;;\n") + (insert ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n") + (insert "(defun yas/initialize-bundle ()\n" + " \"Initialize YASnippet and load snippets in the bundle.\"") + (flet ((yas/define-snippets + (mode snippets &optional parent-or-parents) + (insert ";;; snippets for " (symbol-name mode) "\n") + (let ((literal-snippets (list))) + (dolist (snippet snippets) + (let ((key (first snippet)) + (template-content (second snippet)) + (name (third snippet)) + (condition (fourth snippet)) + (group (fifth snippet)) + (expand-env (sixth snippet)) + ;; Omit the file on purpose + (file nil) ;; (seventh snippet)) + (binding (eighth snippet))) + (push `(,key + ,template-content + ,name + ,condition + ,group + ,expand-env + ,file + ,binding) + literal-snippets))) + (insert (pp-to-string `(yas/define-snippets ',mode ',literal-snippets ',parent-or-parents))) + (insert "\n\n")))) + (dolist (dir dirs) + (dolist (subdir (yas/subdirs dir)) + (yas/load-directory-1 subdir nil 'no-hierarchy-parents)))) + + (insert (pp-to-string `(yas/global-mode 1))) + (insert ")\n\n" code "\n") + + ;; bundle-specific provide and value for yas/dont-activate + (let ((bundle-feature-name (file-name-nondirectory + (file-name-sans-extension + yasnippet-bundle)))) + (insert (pp-to-string `(set-default 'yas/dont-activate + #'(lambda () + (and (or yas/root-directory + (featurep ',(make-symbol bundle-feature-name))) + (null (yas/get-snippet-tables))))))) + (insert (pp-to-string `(provide ',(make-symbol bundle-feature-name))))) + + (insert ";;; " + (file-name-nondirectory yasnippet-bundle) + " ends here\n")))) + +(defun yas/compile-textmate-bundle () + (interactive) + (yas/compile-bundle "yasnippet.el" + "./yasnippet-textmate-bundle.el" + "extras/imported/" + (concat "(yas/initialize-bundle)" + "\n;;;###autoload" ; break through so that won't + "(require 'yasnippet-textmate-bundle)") + "dropdown-list.el")) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Some user level functions +;;; + +(defun yas/about () + (interactive) + (message (concat "yasnippet (version " + yas/version + ") -- pluskid /joaotavora "))) + +(defun yas/define-snippets (mode snippets &optional parent-mode) + "Define SNIPPETS for MODE. + +SNIPPETS is a list of snippet definitions, each taking the +following form: + + (KEY TEMPLATE NAME CONDITION GROUP EXPAND-ENV FILE KEYBINDING) + +Within these, only TEMPLATE is actually mandatory. + +All the elelements are strings, including CONDITION, EXPAND-ENV +and KEYBINDING which will be `read' and eventually `eval'-ed. + +FILE is probably of very little use if you're programatically +defining snippets. + +You can use `yas/parse-template' to return such lists based on +the current buffers contents. + +Optional PARENT-MODE can be used to specify the parent tables of +MODE. It can be a mode symbol of a list of mode symbols. It does +not need to be a real mode." + (let ((snippet-table (yas/snippet-table-get-create mode)) + (parent-tables (mapcar #'yas/snippet-table-get-create + (if (listp parent-mode) + parent-mode + (list parent-mode)))) + (keymap (if yas/use-menu + (yas/menu-keymap-get-create mode) + nil))) + ;; Setup the menu + ;; + (when parent-tables + (setf (yas/snippet-table-parents snippet-table) + parent-tables) + (when yas/use-menu + (let ((parent-menu-syms-and-names + (if (listp parent-mode) + (mapcar #'(lambda (sym) + (cons sym (concat "parent mode - " (symbol-name sym)))) + parent-mode) + '((parent-mode . "parent mode"))))) + (mapc #'(lambda (sym-and-name) + (define-key keymap + (vector (intern (replace-regexp-in-string " " "_" (cdr sym-and-name)))) + (list 'menu-item (cdr sym-and-name) + (yas/menu-keymap-get-create (car sym-and-name))))) + (reverse parent-menu-syms-and-names))))) + (when yas/use-menu + (define-key yas/minor-mode-menu (vector mode) + `(menu-item ,(symbol-name mode) ,keymap + :visible (yas/show-menu-p ',mode)))) + ;; Iterate the recently parsed snippets definition + ;; + (dolist (snippet snippets) + (let* ((file (seventh snippet)) + (key (or (car snippet) + (unless yas/ignore-filenames-as-triggers + (and file + (file-name-sans-extension (file-name-nondirectory file)))))) + (name (or (third snippet) + (and file + (file-name-directory file)))) + (condition (fourth snippet)) + (group (fifth snippet)) + (keybinding (eighth snippet)) + (template nil)) + ;; Read the snippet's "binding :" expression + ;; + (condition-case err + (when keybinding + (setq keybinding (read (eighth snippet))) + (let* ((this-mode-map-symbol (intern (concat (symbol-name mode) "-map"))) + (keys (or (and (consp keybinding) + (read-kbd-macro (cdr keybinding))) + (read-kbd-macro keybinding))) + (keymap-symbol (or (and (consp keybinding) + (car keybinding)) + this-mode-map-symbol))) + (if (and (boundp keymap-symbol) + (keymapp (symbol-value keymap-symbol))) + (setq keybinding (list keymap-symbol + keys + name)) + (error (format "keymap \"%s\" does not (yet?) exist" keymap-symbol))))) + (error + (message "[yas] warning: keybinding \"%s\" invalid for snippet \"%s\" since %s." + keybinding name (error-message-string err)) + (setf keybinding nil))) + + ;; Create the `yas/template' object and store in the + ;; appropriate snippet table. This only done if we have found + ;; a key and a name for the snippet, because that is what + ;; indexes the snippet tables + ;; + (setq template (yas/make-template (second snippet) + (or name key) + condition + (sixth snippet) + (seventh snippet) + keybinding)) + (when (and key + name) + (yas/store snippet-table + name + key + template)) + ;; If we have a keybinding, register it if it does not + ;; conflict! + ;; + (when keybinding + (let ((lookup (lookup-key (symbol-value (first keybinding)) (second keybinding)))) + (if (and lookup + (not (numberp lookup))) + (message "[yas] warning: won't overwrite keybinding \"%s\" for snippet \"%s\" in `%s'" + (key-description (second keybinding)) name (first keybinding)) + (define-key + (symbol-value (first keybinding)) + (second keybinding) + `(lambda (&optional yas/prefix) + (interactive "P") + (when (yas/template-can-expand-p ,(yas/template-condition template)) + (yas/expand-snippet ,(yas/template-content template) + nil + nil + ,(yas/template-expand-env template))))) + (add-to-list 'yas/active-keybindings keybinding)))) + + ;; Setup the menu groups, reorganizing from group to group if + ;; necessary + ;; + (when yas/use-menu + (let ((group-keymap keymap)) + ;; Delete this entry from another group if already exists + ;; in some other group. An entry is considered as existing + ;; in another group if its name string-matches. + ;; + (yas/delete-from-keymap group-keymap name) + + ;; ... then add this entry to the correct group + (when (and (not (null group)) + (not (string= "" group))) + (dolist (subgroup (mapcar #'make-symbol + (split-string group "\\."))) + (let ((subgroup-keymap (lookup-key group-keymap + (vector subgroup)))) + (when (null subgroup-keymap) + (setq subgroup-keymap (make-sparse-keymap)) + (define-key group-keymap (vector subgroup) + `(menu-item ,(symbol-name subgroup) + ,subgroup-keymap))) + (setq group-keymap subgroup-keymap)))) + (define-key group-keymap (vector (gensym)) + `(menu-item ,(yas/template-name template) + ,(yas/make-menu-binding template) + :help ,name + :keys ,(when (and key name) + (concat key yas/trigger-symbol)))))))))) + +(defun yas/show-menu-p (mode) + (cond ((eq yas/use-menu 'abbreviate) + (find mode + (mapcar #'(lambda (table) + (intern (yas/snippet-table-name table))) + (yas/get-snippet-tables)))) + ((eq yas/use-menu 'real-modes) + (yas/real-mode? mode)) + (t + t))) + +(defun yas/delete-from-keymap (keymap name) + "Recursively delete items name NAME from KEYMAP and its submenus. + +Skip any submenus named \"parent mode\"" + ;; First of all, recursively enter submenus, i.e. the tree is + ;; searched depth first so that stale submenus can be found in the + ;; higher passes. + ;; + (mapc #'(lambda (item) + (when (and (keymapp (fourth item)) + (stringp (third item)) + (not (string-match "parent mode" (third item)))) + (yas/delete-from-keymap (fourth item) name))) + (rest keymap)) + ;; + (when (keymapp keymap) + (let ((pos-in-keymap)) + (while (setq pos-in-keymap + (position-if #'(lambda (item) + (and (listp item) + (or + ;; the menu item we want to delete + (and (eq 'menu-item (second item)) + (third item) + (and (string= (third item) name))) + ;; a stale subgroup + (and (keymapp (fourth item)) + (not (and (stringp (third item)) + (string-match "parent mode" + (third item)))) + (null (rest (fourth item))))))) + keymap)) + (setf (nthcdr pos-in-keymap keymap) + (nthcdr (+ 1 pos-in-keymap) keymap)))))) + +(defun yas/define (mode key template &optional name condition group) + "Define a snippet. Expanding KEY into TEMPLATE. + +NAME is a description to this template. Also update the menu if +`yas/use-menu' is `t'. CONDITION is the condition attached to +this snippet. If you attach a condition to a snippet, then it +will only be expanded when the condition evaluated to non-nil." + (yas/define-snippets mode + (list (list key template name condition group)))) + +(defun yas/hippie-try-expand (first-time?) + "Integrate with hippie expand. Just put this function in +`hippie-expand-try-functions-list'." + (if (not first-time?) + (let ((yas/fallback-behavior 'return-nil)) + (yas/expand)) + (undo 1) + nil)) + +(defun yas/expand () + "Expand a snippet before point. + +If no snippet expansion is possible, fall back to the behaviour +defined in `yas/fallback-behavior'" + (interactive) + (yas/expand-1)) + +(defun yas/expand-1 (&optional field) + "Actually fo the work for `yas/expand'" + (multiple-value-bind (templates start end) (if field + (save-restriction + (narrow-to-region (yas/field-start field) (yas/field-end field)) + (yas/current-key)) + (yas/current-key)) + (if templates + (let ((template (or (and (rest templates) ;; more than one + (yas/prompt-for-template (mapcar #'cdr templates))) + (cdar templates)))) + (when template + (yas/expand-snippet (yas/template-content template) + start + end + (yas/template-expand-env template)))) + (cond ((eq yas/fallback-behavior 'return-nil) + ;; return nil + nil) + ((eq yas/fallback-behavior 'call-other-command) + (let* ((yas/minor-mode nil) + (keys-1 (this-command-keys-vector)) + (keys-2 (and yas/trigger-key + (stringp yas/trigger-key) + (read-kbd-macro yas/trigger-key))) + (command-1 (and keys-1 (key-binding keys-1))) + (command-2 (and keys-2 (key-binding keys-2))) + (command (or (and (not (eq command-1 'yas/expand)) + command-1) + command-2))) + (when (and (commandp command) + (not (eq 'yas/expand command))) + (setq this-command command) + (call-interactively command)))) + ((and (listp yas/fallback-behavior) + (cdr yas/fallback-behavior) + (eq 'apply (car yas/fallback-behavior))) + (if (cddr yas/fallback-behavior) + (apply (cadr yas/fallback-behavior) + (cddr yas/fallback-behavior)) + (when (commandp (cadr yas/fallback-behavior)) + (setq this-command (cadr yas/fallback-behavior)) + (call-interactively (cadr yas/fallback-behavior))))) + (t + ;; also return nil if all the other fallbacks have failed + nil))))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Snippet development + +(defun yas/all-templates (tables) + "Return all snippet tables applicable for the current buffer. + +Honours `yas/choose-tables-first', `yas/choose-keys-first' and +`yas/buffer-local-condition'" + (when yas/choose-tables-first + (setq tables (list (yas/prompt-for-table tables)))) + (mapcar #'cdr + (if yas/choose-keys-first + (let ((key (yas/prompt-for-keys + (mapcan #'yas/snippet-table-all-keys tables)))) + (when key + (mapcan #'(lambda (table) + (yas/fetch table key)) + tables))) + (mapcan #'yas/snippet-table-templates tables)))) + +(defun yas/insert-snippet (&optional no-condition) + "Choose a snippet to expand, pop-up a list of choices according +to `yas/prompt-function'. + +With prefix argument NO-CONDITION, bypass filtering of snippets +by condition." + (interactive "P") + (let* ((yas/buffer-local-condition (or (and no-condition + 'always) + yas/buffer-local-condition)) + (templates (yas/all-templates (yas/get-snippet-tables))) + (template (and templates + (or (and (rest templates) ;; more than one template for same key + (yas/prompt-for-template templates)) + (car templates)))) + (where (if mark-active + (cons (region-beginning) (region-end)) + (cons (point) (point))))) + (if template + (yas/expand-snippet (yas/template-content template) + (car where) + (cdr where) + (yas/template-expand-env template)) + (message "[yas] No snippets can be inserted here!")))) + +(defun yas/visit-snippet-file () + "Choose a snippet to edit, selection like `yas/insert-snippet'. + +Only success if selected snippet was loaded from a file. Put the +visited file in `snippet-mode'." + (interactive) + (let* ((yas/buffer-local-condition 'always) + (templates (yas/all-templates (yas/get-snippet-tables))) + (template (and templates + (or (and (rest templates) ;; more than one template for same key + (yas/prompt-for-template templates + "Choose a snippet template to edit: ")) + (car templates))))) + + (when template + (yas/visit-snippet-file-1 template)))) + +(defun yas/visit-snippet-file-1 (template) + (let ((file (yas/template-file template))) + (cond ((and file (file-exists-p file)) + (find-file-other-window file) + (snippet-mode)) + (file + (message "Original file %s no longer exists!" file)) + (t + (message "This snippet was not loaded from a file!"))))) + +(defun yas/guess-snippet-directories-1 (table &optional suffix) + "Guesses possible snippet subdirsdirectories for TABLE." + (unless suffix + (setq suffix (yas/snippet-table-name table))) + (cons suffix + (mapcan #'(lambda (parent) + (yas/guess-snippet-directories-1 + parent + (concat (yas/snippet-table-name parent) "/" suffix))) + (yas/snippet-table-parents table)))) + +(defun yas/guess-snippet-directories () + "Try to guess suitable directories based on the current active +tables. + +Returns a a list of options alist TABLE -> DIRS where DIRS are +all the possibly directories where snippets of table might be +lurking." + (let ((main-dir (or (and (listp yas/root-directory) + (first yas/root-directory)) + yas/root-directory + (setq yas/root-directory "~/.emacs.d/snippets"))) + (tables (yas/get-snippet-tables))) + ;; HACK! the snippet table created here is a dummy table that + ;; holds the correct name so that `yas/make-directory-maybe' can + ;; work. The real table, if it does not exist in + ;; yas/snippet-tables will be created when the first snippet for + ;; that mode is loaded. + ;; + (unless (gethash major-mode yas/snippet-tables) + (setq tables (cons (yas/make-snippet-table (symbol-name major-mode)) + tables))) + + (mapcar #'(lambda (table) + (cons table + (mapcar #'(lambda (subdir) + (concat main-dir "/" subdir)) + (yas/guess-snippet-directories-1 table)))) + tables))) + +(defun yas/make-directory-maybe (table-and-dirs &optional main-table-string) + "Returns a dir inside TABLE-AND-DIRS, prompts for creation if none exists." + (or (some #'(lambda (dir) (when (file-directory-p dir) dir)) (cdr table-and-dirs)) + (let ((candidate (first (cdr table-and-dirs)))) + (if (y-or-n-p (format "Guessed directory (%s) for%s%s table \"%s\" does not exist! Create? " + candidate + (if (gethash (intern (yas/snippet-table-name (car table-and-dirs))) + yas/snippet-tables) + "" + " brand new") + (or main-table-string + "") + (yas/snippet-table-name (car table-and-dirs)))) + (progn + (make-directory candidate 'also-make-parents) + ;; create the .yas-parents file here... + candidate))))) + +(defun yas/new-snippet (&optional choose-instead-of-guess) + "" + (interactive "P") + (let* ((guessed-directories (yas/guess-snippet-directories)) + (option (or (and choose-instead-of-guess + (some #'(lambda (fn) + (funcall fn "Choose a snippet table: " + guessed-directories + #'(lambda (option) + (yas/snippet-table-name (car option))))) + yas/prompt-functions)) + (first guessed-directories))) + (chosen)) + (setq chosen (yas/make-directory-maybe option (unless choose-instead-of-guess + " main"))) + (unless (or chosen + choose-instead-of-guess) + (if (y-or-n-p (format "Continue guessing for other active tables %s? " + (mapcar #'(lambda (table-and-dirs) + (yas/snippet-table-name (car table-and-dirs))) + (rest guessed-directories)))) + (setq chosen (some #'yas/make-directory-maybe + (rest guessed-directories))))) + (unless (or chosen + choose-instead-of-guess) + (when (y-or-n-p "Having trouble... use snippet root dir? ") + (setq chosen (if (listp yas/root-directory) + (first yas/root-directory) + yas/root-directory)))) + (if chosen + (let ((default-directory chosen) + (name (read-from-minibuffer "Enter a snippet name: "))) + (find-file-other-window (concat name + ".yasnippet")) + (snippet-mode) + (unless (and choose-instead-of-guess + (not (y-or-n-p "Insert a snippet with useful headers? "))) + (yas/expand-snippet (format + "\ +# -*- mode: snippet -*- +# name: %s +# key: $1${2: +# binding: \"${3:keybinding}\"}${4: +# expand-env: ((${5:some-var} ${6:some-value}))} +# -- +$0" name)))) + (message "[yas] aborted snippet creation.")))) + +(defun yas/find-snippets (&optional same-window ) + "Look for user snippets in guessed current mode's directory. + +Calls `find-file' interactively in the guessed directory. + +With prefix arg SAME-WINDOW opens the buffer in the same window. + +Because snippets can be loaded from many different locations, +this has to guess the correct directory using +`yas/guess-snippet-directories', which returns a list of +options. + +If any one of these exists, it is taken and `find-file' is called +there, otherwise, proposes to create the first option returned by +`yas/guess-snippet-directories'." + (interactive "P") + (let* ((guessed-directories (yas/guess-snippet-directories)) + (chosen) + (buffer)) + (setq chosen (yas/make-directory-maybe (first guessed-directories) " main")) + (unless chosen + (if (y-or-n-p (format "Continue guessing for other active tables %s? " + (mapcar #'(lambda (table-and-dirs) + (yas/snippet-table-name (car table-and-dirs))) + (rest guessed-directories)))) + (setq chosen (some #'yas/make-directory-maybe + (rest guessed-directories))))) + (unless chosen + (when (y-or-n-p "Having trouble... go to snippet root dir? ") + (setq chosen (if (listp yas/root-directory) + (first yas/root-directory) + yas/root-directory)))) + (if chosen + (let ((default-directory chosen)) + (setq buffer (call-interactively (if same-window + 'find-file + 'find-file-other-window))) + (when buffer + (save-excursion + (set-buffer buffer) + (when (eq major-mode 'fundamental-mode) + (snippet-mode))))) + (message "Could not guess snippet dir!")))) + +(defun yas/compute-major-mode-and-parents (file &optional prompt-if-failed no-hierarchy-parents) + (let* ((file-dir (and file + (directory-file-name (or (locate-dominating-file file ".yas-make-groups") + (directory-file-name (file-name-directory file)))))) + (major-mode-name (and file-dir + (file-name-nondirectory file-dir))) + (parent-file-dir (and file-dir + (directory-file-name (file-name-directory file-dir)))) + (parent-mode-name (and parent-file-dir + (not no-hierarchy-parents) + (file-name-nondirectory parent-file-dir))) + (major-mode-sym (or (and major-mode-name + (intern major-mode-name)) + (when prompt-if-failed + (read-from-minibuffer + "[yas] Cannot auto-detect major mode! Enter a major mode: ")))) + (parent-mode-sym (and parent-mode-name + (intern parent-mode-name))) + (extra-parents-file-name (concat file-dir "/.yas-parents")) + (more-parents (when (file-readable-p extra-parents-file-name) + (mapcar #'intern + (split-string + (with-temp-buffer + (insert-file-contents extra-parents-file-name) + (buffer-substring-no-properties (point-min) + (point-max)))))))) + (when major-mode-sym + (remove nil (append (list major-mode-sym parent-mode-sym) + more-parents))))) + +(defun yas/load-snippet-buffer (&optional kill) + "Parse and load current buffer's snippet definition. + +With optional prefix argument KILL quit the window and buffer." + (interactive "P") + (if buffer-file-name + (let ((major-mode-and-parent (yas/compute-major-mode-and-parents buffer-file-name))) + (if major-mode-and-parent + (let* ((parsed (yas/parse-template buffer-file-name)) + (name (and parsed + (third parsed)))) + (when name + (let ((yas/better-guess-for-replacements t)) + (yas/define-snippets (car major-mode-and-parent) + (list parsed) + (cdr major-mode-and-parent))) + (when (and (buffer-modified-p) + (y-or-n-p "Save snippet? ")) + (save-buffer)) + (if kill + (quit-window kill) + (message "[yas] Snippet \"%s\" loaded for %s." + name + (car major-mode-and-parent))))) + (message "[yas] Cannot load snippet for unknown major mode"))) + (message "Save the buffer as a file first!"))) + +(defun yas/tryout-snippet (&optional debug) + "Test current buffers's snippet template in other buffer." + (interactive "P") + (let* ((major-mode-and-parent (yas/compute-major-mode-and-parents buffer-file-name)) + (parsed (yas/parse-template)) + (test-mode (or (and (car major-mode-and-parent) + (fboundp (car major-mode-and-parent)) + (car major-mode-and-parent)) + (intern (read-from-minibuffer "[yas] please input a mode: ")))) + (template (and parsed + (fboundp test-mode) + (yas/make-template (second parsed) + (third parsed) + nil + (sixth parsed) + nil + nil)))) + (cond (template + (let ((buffer-name (format "*YAS TEST: %s*" (yas/template-name template)))) + (set-buffer (switch-to-buffer buffer-name)) + (erase-buffer) + (setq buffer-undo-list nil) + (funcall test-mode) + (yas/expand-snippet (yas/template-content template) + (point-min) + (point-max) + (yas/template-expand-env template)) + (when debug + (add-hook 'post-command-hook 'yas/debug-snippet-vars 't 'local)))) + (t + (message "[yas] Cannot test snippet for unknown major mode"))))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; User convenience functions, for using in snippet definitions + +(defvar yas/modified-p nil + "Non-nil if field has been modified by user or transformation.") + +(defvar yas/moving-away-p nil + "Non-nil if user is about to exit field.") + +(defvar yas/text nil + "Contains current field text.") + +(defun yas/substr (str pattern &optional subexp) + "Search PATTERN in STR and return SUBEXPth match. + +If found, the content of subexp group SUBEXP (default 0) is + returned, or else the original STR will be returned." + (let ((grp (or subexp 0))) + (save-match-data + (if (string-match pattern str) + (match-string-no-properties grp str) + str)))) + +(defun yas/choose-value (possibilities) + "Prompt for a string in the list POSSIBILITIES and return it." + (unless (or yas/moving-away-p + yas/modified-p) + (some #'(lambda (fn) + (funcall fn "Choose: " possibilities)) + yas/prompt-functions))) + +(defun yas/key-to-value (alist) + "Prompt for a string in the list POSSIBILITIES and return it." + (unless (or yas/moving-away-p + yas/modified-p) + (let ((key (read-key-sequence ""))) + (when (stringp key) + (or (cdr (find key alist :key #'car :test #'string=)) + key))))) + +(defun yas/throw (text) + "Throw a yas/exception with TEXT as the reason." + (throw 'yas/exception (cons 'yas/exception text))) + +(defun yas/verify-value (possibilities) + "Verify that the current field value is in POSSIBILITIES + +Otherwise throw exception." + (when (and yas/moving-away-p (notany #'(lambda (pos) (string= pos yas/text)) possibilities)) + (yas/throw (format "[yas] field only allows %s" possibilities)))) + +(defun yas/field-value (number) + (let* ((snippet (car (yas/snippets-at-point))) + (field (and snippet + (yas/snippet-find-field snippet number)))) + (when field + (yas/field-text-for-display field)))) + +(defun yas/default-from-field (number) + (unless yas/modified-p + (yas/field-value number))) + +(defun yas/inside-string () + (equal 'font-lock-string-face (get-char-property (1- (point)) 'face))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Snippet expansion and field management + +(defvar yas/active-field-overlay nil + "Overlays the currently active field.") + +(defvar yas/field-protection-overlays nil + "Two overlays protect the current active field ") + +(defconst yas/prefix nil + "A prefix argument for expansion direct from keybindings") + +(defvar yas/deleted-text nil + "The text deleted in the last snippet expansion.") + +(defvar yas/selected-text nil + "The selected region deleted on the last snippet expansion.") + +(defvar yas/start-column nil + "The column where the snippet expansion started.") + +(make-variable-buffer-local 'yas/active-field-overlay) +(make-variable-buffer-local 'yas/field-protection-overlays) +(make-variable-buffer-local 'yas/deleted-text) + +(defstruct (yas/snippet (:constructor yas/make-snippet ())) + "A snippet. + +..." + (fields '()) + (exit nil) + (id (yas/snippet-next-id) :read-only t) + (control-overlay nil) + active-field + ;; stacked expansion: the `previous-active-field' slot saves the + ;; active field where the child expansion took place + previous-active-field + force-exit) + +(defstruct (yas/field (:constructor yas/make-field (number start end parent-field))) + "A field." + number + start end + parent-field + (mirrors '()) + (transform nil) + (modified-p nil) + next) + +(defstruct (yas/mirror (:constructor yas/make-mirror (start end transform))) + "A mirror." + start end + (transform nil) + next) + +(defstruct (yas/exit (:constructor yas/make-exit (marker))) + marker + next) + +(defun yas/apply-transform (field-or-mirror field) + "Calculate the value of the field/mirror. If there's a transform +for this field, apply it. Otherwise, returned nil." + (let* ((yas/text (yas/field-text-for-display field)) + (text yas/text) + (yas/modified-p (yas/field-modified-p field)) + (yas/moving-away-p nil) + (transform (if (yas/mirror-p field-or-mirror) + (yas/mirror-transform field-or-mirror) + (yas/field-transform field-or-mirror))) + (start-point (if (yas/mirror-p field-or-mirror) + (yas/mirror-start field-or-mirror) + (yas/field-start field-or-mirror))) + (transformed (and transform + (save-excursion + (goto-char start-point) + (yas/read-and-eval-string transform))))) + transformed)) + +(defsubst yas/replace-all (from to &optional text) + "Replace all occurance from FROM to TO. + +With optional string TEXT do it in that string." + (if text + (replace-regexp-in-string (regexp-quote from) to text t t) + (goto-char (point-min)) + (while (search-forward from nil t) + (replace-match to t t text)))) + +(defun yas/snippet-find-field (snippet number) + (find-if #'(lambda (field) + (eq number (yas/field-number field))) + (yas/snippet-fields snippet))) + +(defun yas/snippet-sort-fields (snippet) + "Sort the fields of SNIPPET in navigation order." + (setf (yas/snippet-fields snippet) + (sort (yas/snippet-fields snippet) + '(lambda (field1 field2) + (yas/snippet-field-compare field1 field2))))) + +(defun yas/snippet-field-compare (field1 field2) + "Compare two fields. The field with a number is sorted first. +If they both have a number, compare through the number. If neither +have, compare through the field's start point" + (let ((n1 (yas/field-number field1)) + (n2 (yas/field-number field2))) + (if n1 + (if n2 + (< n1 n2) + t) + (if n2 + nil + (< (yas/field-start field1) + (yas/field-start field2)))))) + +(defun yas/field-probably-deleted-p (snippet field) + "Guess if SNIPPET's FIELD should be skipped." + (and (zerop (- (yas/field-start field) (yas/field-end field))) + (or (yas/field-parent-field field) + (and (eq field (car (last (yas/snippet-fields snippet)))) + (= (yas/field-start field) (overlay-end (yas/snippet-control-overlay snippet))))))) + +(defun yas/snippets-at-point (&optional all-snippets) + "Return a sorted list of snippets at point, most recently +inserted first." + (sort + (remove nil (remove-duplicates (mapcar #'(lambda (ov) + (overlay-get ov 'yas/snippet)) + (if all-snippets + (overlays-in (point-min) (point-max)) + (overlays-at (point)))))) + #'(lambda (s1 s2) + (<= (yas/snippet-id s2) (yas/snippet-id s1))))) + +(defun yas/next-field-or-maybe-expand () + "Try to expand a snippet at a key before point, otherwise +delegate to `yas/next-field'." + (interactive) + (if yas/triggers-in-field + (let ((yas/fallback-behavior 'return-nil) + (active-field (overlay-get yas/active-field-overlay 'yas/field))) + (when active-field + (unless (yas/expand-1 active-field) + (yas/next-field)))) + (yas/next-field))) + +(defun yas/next-field (&optional arg) + "Navigate to next field. If there's none, exit the snippet." + (interactive) + (let* ((arg (or arg + 1)) + (snippet (first (yas/snippets-at-point))) + (active-field (overlay-get yas/active-field-overlay 'yas/field)) + (live-fields (remove-if #'(lambda (field) + (and (not (eq field active-field)) + (yas/field-probably-deleted-p snippet field))) + (yas/snippet-fields snippet))) + (active-field-pos (position active-field live-fields)) + (target-pos (and active-field-pos (+ arg active-field-pos))) + (target-field (nth target-pos live-fields))) + ;; First check if we're moving out of a field with a transform + ;; + (when (and active-field + (yas/field-transform active-field)) + (let* ((yas/moving-away-p t) + (yas/text (yas/field-text-for-display active-field)) + (text yas/text) + (yas/modified-p (yas/field-modified-p active-field))) + ;; primary field transform: exit call to field-transform + (yas/read-and-eval-string (yas/field-transform active-field)))) + ;; Now actually move... + (cond ((>= target-pos (length live-fields)) + (yas/exit-snippet snippet)) + (target-field + (yas/move-to-field snippet target-field)) + (t + nil)))) + +(defun yas/place-overlays (snippet field) + "Correctly place overlays for SNIPPET's FIELD" + (yas/make-move-field-protection-overlays snippet field) + (yas/make-move-active-field-overlay snippet field)) + +(defun yas/move-to-field (snippet field) + "Update SNIPPET to move to field FIELD. + +Also create some protection overlays" + (goto-char (yas/field-start field)) + (setf (yas/snippet-active-field snippet) field) + (yas/place-overlays snippet field) + (overlay-put yas/active-field-overlay 'yas/field field) + ;; primary field transform: first call to snippet transform + (unless (yas/field-modified-p field) + (if (yas/field-update-display field snippet) + (let ((inhibit-modification-hooks t)) + (yas/update-mirrors snippet)) + (setf (yas/field-modified-p field) nil)))) + +(defun yas/prev-field () + "Navigate to prev field. If there's none, exit the snippet." + (interactive) + (yas/next-field -1)) + +(defun yas/abort-snippet (&optional snippet) + (interactive) + (let ((snippet (or snippet + (car (yas/snippets-at-point))))) + (when snippet + (setf (yas/snippet-force-exit snippet) t)))) + +(defun yas/exit-snippet (snippet) + "Goto exit-marker of SNIPPET." + (interactive) + (setf (yas/snippet-force-exit snippet) t) + (goto-char (if (yas/snippet-exit snippet) + (yas/exit-marker (yas/snippet-exit snippet)) + (overlay-end (yas/snippet-control-overlay snippet))))) + +(defun yas/exit-all-snippets () + "Exit all snippets." + (interactive) + (mapc #'(lambda (snippet) + (yas/exit-snippet snippet) + (yas/check-commit-snippet)) + (yas/snippets-at-point))) + + +;;; Apropos markers-to-points: +;;; +;;; This was found useful for performance reasons, so that an +;;; excessive number of live markers aren't kept around in the +;;; `buffer-undo-list'. However, in `markers-to-points', the +;;; set-to-nil markers can't simply be discarded and replaced with +;;; fresh ones in `points-to-markers'. The original marker that was +;;; just set to nil has to be reused. +;;; +;;; This shouldn't bring horrible problems with undo/redo, but it +;;; you never know +;;; + +(defun yas/markers-to-points (snippet) + "Convert all markers in SNIPPET to a cons (POINT . MARKER) +where POINT is the original position of the marker and MARKER is +the original marker object with the position set to nil." + (dolist (field (yas/snippet-fields snippet)) + (let ((start (marker-position (yas/field-start field))) + (end (marker-position (yas/field-end field)))) + (set-marker (yas/field-start field) nil) + (set-marker (yas/field-end field) nil) + (setf (yas/field-start field) (cons start (yas/field-start field))) + (setf (yas/field-end field) (cons end (yas/field-end field)))) + (dolist (mirror (yas/field-mirrors field)) + (let ((start (marker-position (yas/mirror-start mirror))) + (end (marker-position (yas/mirror-end mirror)))) + (set-marker (yas/mirror-start mirror) nil) + (set-marker (yas/mirror-end mirror) nil) + (setf (yas/mirror-start mirror) (cons start (yas/mirror-start mirror))) + (setf (yas/mirror-end mirror) (cons end (yas/mirror-end mirror)))))) + (let ((snippet-exit (yas/snippet-exit snippet))) + (when snippet-exit + (let ((exit (marker-position (yas/exit-marker snippet-exit)))) + (set-marker (yas/exit-marker snippet-exit) nil) + (setf (yas/exit-marker snippet-exit) (cons exit (yas/exit-marker snippet-exit))))))) + +(defun yas/points-to-markers (snippet) + "Convert all cons (POINT . MARKER) in SNIPPET to markers. This +is done by setting MARKER to POINT with `set-marker'." + (dolist (field (yas/snippet-fields snippet)) + (setf (yas/field-start field) (set-marker (cdr (yas/field-start field)) + (car (yas/field-start field)))) + (setf (yas/field-end field) (set-marker (cdr (yas/field-end field)) + (car (yas/field-end field)))) + (dolist (mirror (yas/field-mirrors field)) + (setf (yas/mirror-start mirror) (set-marker (cdr (yas/mirror-start mirror)) + (car (yas/mirror-start mirror)))) + (setf (yas/mirror-end mirror) (set-marker (cdr (yas/mirror-end mirror)) + (car (yas/mirror-end mirror)))))) + (let ((snippet-exit (yas/snippet-exit snippet))) + (when snippet-exit + (setf (yas/exit-marker snippet-exit) (set-marker (cdr (yas/exit-marker snippet-exit)) + (car (yas/exit-marker snippet-exit))))))) + +(defun yas/commit-snippet (snippet &optional no-hooks) + "Commit SNIPPET, but leave point as it is. This renders the +snippet as ordinary text. + +Return a buffer position where the point should be placed if +exiting the snippet. + +NO-HOOKS means don't run the `yas/after-exit-snippet-hook' hooks." + + (let ((control-overlay (yas/snippet-control-overlay snippet)) + yas/snippet-beg + yas/snippet-end) + ;; + ;; Save the end of the moribund snippet in case we need to revive it + ;; its original expansion. + ;; + (when (and control-overlay + (overlay-buffer control-overlay)) + (setq yas/snippet-beg (overlay-start control-overlay)) + (setq yas/snippet-end (overlay-end control-overlay)) + (delete-overlay control-overlay)) + + (let ((inhibit-modification-hooks t)) + (when yas/active-field-overlay + (delete-overlay yas/active-field-overlay)) + (when yas/field-protection-overlays + (mapc #'delete-overlay yas/field-protection-overlays))) + + ;; stacked expansion: if the original expansion took place from a + ;; field, make sure we advance it here at least to + ;; `yas/snippet-end'... + ;; + (let ((previous-field (yas/snippet-previous-active-field snippet))) + (when (and yas/snippet-end previous-field) + (yas/advance-end-maybe previous-field yas/snippet-end))) + + ;; Convert all markers to points, + ;; + (yas/markers-to-points snippet) + + ;; Take care of snippet revival + ;; + (if yas/snippet-revival + (push `(apply yas/snippet-revive ,yas/snippet-beg ,yas/snippet-end ,snippet) + buffer-undo-list) + ;; Dismember the snippet... this is useful if we get called + ;; again from `yas/take-care-of-redo'.... + (setf (yas/snippet-fields snippet) nil)) + + ;; XXX: `yas/after-exit-snippet-hook' should be run with + ;; `yas/snippet-beg' and `yas/snippet-end' bound. That might not + ;; be the case if the main overlay had somehow already + ;; disappeared, which sometimes happens when the snippet's messed + ;; up... + ;; + (unless no-hooks (run-hooks 'yas/after-exit-snippet-hook))) + + (message "[yas] snippet exited.")) + +(defun yas/check-commit-snippet () + "Checks if point exited the currently active field of the +snippet, if so cleans up the whole snippet up." + (let* ((snippets (yas/snippets-at-point 'all-snippets)) + (snippets-left snippets)) + (dolist (snippet snippets) + (let ((active-field (yas/snippet-active-field snippet))) + (cond ((or (prog1 (yas/snippet-force-exit snippet) + (setf (yas/snippet-force-exit snippet) nil)) + (not (and active-field (yas/field-contains-point-p active-field)))) + (setq snippets-left (delete snippet snippets-left)) + (yas/commit-snippet snippet snippets-left)) + ((and active-field + (or (not yas/active-field-overlay) + (not (overlay-buffer yas/active-field-overlay)))) + ;; + ;; stacked expansion: this case is mainly for recent + ;; snippet exits that place us back int the field of + ;; another snippet + ;; + (save-excursion + (yas/move-to-field snippet active-field) + (yas/update-mirrors snippet))) + (t + nil)))) + (unless snippets-left + (remove-hook 'post-command-hook 'yas/post-command-handler 'local) + (remove-hook 'pre-command-hook 'yas/pre-command-handler 'local)))) + +(defun yas/field-contains-point-p (field &optional point) + (let ((point (or point + (point)))) + (and (>= point (yas/field-start field)) + (<= point (yas/field-end field))))) + +(defun yas/field-text-for-display (field) + "Return the propertized display text for field FIELD. " + (buffer-substring (yas/field-start field) (yas/field-end field))) + +(defun yas/undo-in-progress () + "True if some kind of undo is in progress" + (or undo-in-progress + (eq this-command 'undo) + (eq this-command 'redo))) + +(defun yas/make-control-overlay (snippet start end) + "Creates the control overlay that surrounds the snippet and +holds the keymap." + (let ((overlay (make-overlay start + end + nil + nil + t))) + (overlay-put overlay 'keymap yas/keymap) + (overlay-put overlay 'yas/snippet snippet) + overlay)) + +(defun yas/skip-and-clear-or-delete-char (&optional field) + "Clears unmodified field if at field start, skips to next tab. + +Otherwise deletes a character normally by calling `delete-char'." + (interactive) + (let ((field (or field + (and yas/active-field-overlay + (overlay-buffer yas/active-field-overlay) + (overlay-get yas/active-field-overlay 'yas/field))))) + (cond ((and field + (not (yas/field-modified-p field)) + (eq (point) (marker-position (yas/field-start field)))) + (yas/skip-and-clear field) + (yas/next-field 1)) + (t + (call-interactively 'delete-char))))) + +(defun yas/skip-and-clear (field) + "Deletes the region of FIELD and sets it modified state to t" + (setf (yas/field-modified-p field) t) + (delete-region (yas/field-start field) (yas/field-end field))) + +(defun yas/make-move-active-field-overlay (snippet field) + "Place the active field overlay in SNIPPET's FIELD. + +Move the overlay, or create it if it does not exit." + (if (and yas/active-field-overlay + (overlay-buffer yas/active-field-overlay)) + (move-overlay yas/active-field-overlay + (yas/field-start field) + (yas/field-end field)) + (setq yas/active-field-overlay + (make-overlay (yas/field-start field) + (yas/field-end field) + nil nil t)) + (overlay-put yas/active-field-overlay 'priority 100) + (overlay-put yas/active-field-overlay 'face 'yas/field-highlight-face) + (overlay-put yas/active-field-overlay 'yas/snippet snippet) + (overlay-put yas/active-field-overlay 'modification-hooks '(yas/on-field-overlay-modification)) + (overlay-put yas/active-field-overlay 'insert-in-front-hooks + '(yas/on-field-overlay-modification)) + (overlay-put yas/active-field-overlay 'insert-behind-hooks + '(yas/on-field-overlay-modification)))) + +(defun yas/on-field-overlay-modification (overlay after? beg end &optional length) + "Clears the field and updates mirrors, conditionally. + +Only clears the field if it hasn't been modified and it point it +at field start. This hook doesn't do anything if an undo is in +progress." + (unless (yas/undo-in-progress) + (let ((field (overlay-get yas/active-field-overlay 'yas/field))) + (cond (after? + (yas/advance-end-maybe field (overlay-end overlay)) +;;; primary field transform: normal calls to expression + (let ((saved-point (point))) + (yas/field-update-display field (car (yas/snippets-at-point))) + (goto-char saved-point)) + (yas/update-mirrors (car (yas/snippets-at-point)))) + (field + (when (and (not after?) + (not (yas/field-modified-p field)) + (eq (point) (if (markerp (yas/field-start field)) + (marker-position (yas/field-start field)) + (yas/field-start field)))) + (yas/skip-and-clear field)) + (setf (yas/field-modified-p field) t)))))) + +;;; Apropos protection overlays: +;;; +;;; These exist for nasty users who will try to delete parts of the +;;; snippet outside the active field. Actual protection happens in +;;; `yas/on-protection-overlay-modification'. +;;; +;;; Currently this signals an error which inhibits the command. For +;;; commands that move point (like `kill-line'), point is restored in +;;; the `yas/post-command-handler' using a global +;;; `yas/protection-violation' variable. +;;; +;;; Alternatively, I've experimented with an implementation that +;;; commits the snippet before actually calling `this-command' +;;; interactively, and then signals an eror, which is ignored. but +;;; blocks all other million modification hooks. This presented some +;;; problems with stacked expansion. +;;; + +(defun yas/make-move-field-protection-overlays (snippet field) + "Place protection overlays surrounding SNIPPET's FIELD. + +Move the overlays, or create them if they do not exit." + (let ((start (yas/field-start field)) + (end (yas/field-end field))) + ;; First check if the (1+ end) is contained in the buffer, + ;; otherwise we'll have to do a bit of cheating and silently + ;; insert a newline. the `(1+ (buffer-size))' should prevent this + ;; when using stacked expansion + ;; + (when (< (buffer-size) end) + (save-excursion + (let ((inhibit-modification-hooks t)) + (goto-char (point-max)) + (newline)))) + ;; go on to normal overlay creation/moving + ;; + (cond ((and yas/field-protection-overlays + (every #'overlay-buffer yas/field-protection-overlays)) + (move-overlay (first yas/field-protection-overlays) (1- start) start) + (move-overlay (second yas/field-protection-overlays) end (1+ end))) + (t + (setq yas/field-protection-overlays + (list (make-overlay (1- start) start nil t nil) + (make-overlay end (1+ end) nil t nil))) + (dolist (ov yas/field-protection-overlays) + (overlay-put ov 'face 'yas/field-debug-face) + (overlay-put ov 'yas/snippet snippet) + ;; (overlay-put ov 'evaporate t) + (overlay-put ov 'modification-hooks '(yas/on-protection-overlay-modification))))))) + +(defvar yas/protection-violation nil + "When non-nil, signals attempts to erronesly exit or modify the snippet. + +Functions in the `post-command-hook', for example +`yas/post-command-handler' can check it and reset its value to +nil. The variables value is the point where the violation +originated") + +(defun yas/on-protection-overlay-modification (overlay after? beg end &optional length) + "Signals a snippet violation, then issues error. + +The error should be ignored in `debug-ignored-errors'" + (cond ((not (or after? + (yas/undo-in-progress))) + (setq yas/protection-violation (point)) + (error "Exit the snippet first!")))) + +(add-to-list 'debug-ignored-errors "^Exit the snippet first!$") + + +;;; Apropos stacked expansion: +;;; +;;; the parent snippet does not run its fields modification hooks +;;; (`yas/on-field-overlay-modification' and +;;; `yas/on-protection-overlay-modification') while the child snippet +;;; is active. This means, among other things, that the mirrors of the +;;; parent snippet are not updated, this only happening when one exits +;;; the child snippet. +;;; +;;; Unfortunately, this also puts some ugly (and not fully-tested) +;;; bits of code in `yas/expand-snippet' and +;;; `yas/commit-snippet'. I've tried to mark them with "stacked +;;; expansion:". +;;; +;;; This was thought to be safer in in an undo/redo perpective, but +;;; maybe the correct implementation is to make the globals +;;; `yas/active-field-overlay' and `yas/field-protection-overlays' be +;;; snippet-local and be active even while the child snippet is +;;; running. This would mean a lot of overlay modification hooks +;;; running, but if managed correctly (including overlay priorities) +;;; they should account for all situations... +;;; + +(defun yas/expand-snippet (template &optional start end expand-env) + "Expand snippet at current point. Text between START and END +will be deleted before inserting template." + (run-hooks 'yas/before-expand-snippet-hook) + + ;; If a region is active, set `yas/selected-text' + (setq yas/selected-text + (when mark-active + (prog1 (buffer-substring-no-properties (region-beginning) + (region-end)) + (unless start (setq start (region-beginning)) + (unless end (setq end (region-end))))))) + + (when start + (goto-char start)) + + ;; stacked expansion: shoosh the overlay modification hooks + ;; + (let ((to-delete (and start end (buffer-substring-no-properties start end))) + (start (or start (point))) + (end (or end (point))) + (inhibit-modification-hooks t) + (column (current-column)) + snippet) + + ;; Delete the region to delete, this *does* get undo-recorded. + ;; + (when (and to-delete + (> end start)) + (delete-region start end) + (setq yas/deleted-text to-delete)) + + ;; Narrow the region down to the template, shoosh the + ;; `buffer-undo-list', and create the snippet, the new snippet + ;; updates its mirrors once, so we are left with some plain text. + ;; The undo action for deleting this plain text will get recorded + ;; at the end of this function. + (save-restriction + (narrow-to-region start start) + (let ((buffer-undo-list t)) + ;; snippet creation might evaluate users elisp, which + ;; might generate errors, so we have to be ready to catch + ;; them mostly to make the undo information + ;; + (setq yas/start-column (save-restriction (widen) (current-column))) + (insert template) + + (setq snippet + (if expand-env + (let ((read-vars (condition-case err + (read expand-env) + (error nil)))) + (eval `(let ,read-vars + (yas/snippet-create (point-min) (point-max))))) + (yas/snippet-create (point-min) (point-max)))))) + + ;; stacked-expansion: This checks for stacked expansion, save the + ;; `yas/previous-active-field' and advance its boudary. + ;; + (let ((existing-field (and yas/active-field-overlay + (overlay-buffer yas/active-field-overlay) + (overlay-get yas/active-field-overlay 'yas/field)))) + (when existing-field + (setf (yas/snippet-previous-active-field snippet) existing-field) + (yas/advance-end-maybe existing-field (overlay-end yas/active-field-overlay)))) + + ;; Exit the snippet immediately if no fields + ;; + (unless (yas/snippet-fields snippet) + (yas/exit-snippet snippet)) + + ;; Push two undo actions: the deletion of the inserted contents of + ;; the new snippet (without the "key") followed by an apply of + ;; `yas/take-care-of-redo' on the newly inserted snippet boundaries + ;; + (let ((start (overlay-start (yas/snippet-control-overlay snippet))) + (end (overlay-end (yas/snippet-control-overlay snippet)))) + (push (cons start end) buffer-undo-list) + (push `(apply yas/take-care-of-redo ,start ,end ,snippet) + buffer-undo-list)) + ;; Now, move to the first field + ;; + (let ((first-field (car (yas/snippet-fields snippet)))) + (when first-field + (yas/move-to-field snippet first-field)))) + (message "[yas] snippet expanded.")) + +(defun yas/take-care-of-redo (beg end snippet) + "Commits SNIPPET, which in turn pushes an undo action for +reviving it. + +Meant to exit in the `buffer-undo-list'." + ;; slightly optimize: this action is only needed for snippets with + ;; at least one field + (when (yas/snippet-fields snippet) + (yas/commit-snippet snippet 'no-hooks))) + +(defun yas/snippet-revive (beg end snippet) + "Revives the SNIPPET and creates a control overlay from BEG to +END. + +BEG and END are, we hope, the original snippets boudaries. All +the markers/points exiting existing inside SNIPPET should point +to their correct locations *at the time the snippet is revived*. + +After revival, push the `yas/take-care-of-redo' in the +`buffer-undo-list'" + ;; Reconvert all the points to markers + ;; + (yas/points-to-markers snippet) + ;; When at least one editable field existed in the zombie snippet, + ;; try to revive the whole thing... + ;; + (let ((target-field (or (yas/snippet-active-field snippet) + (car (yas/snippet-fields snippet))))) + (when target-field + (setf (yas/snippet-control-overlay snippet) (yas/make-control-overlay snippet beg end)) + (overlay-put (yas/snippet-control-overlay snippet) 'yas/snippet snippet) + + (yas/move-to-field snippet target-field) + + (add-hook 'post-command-hook 'yas/post-command-handler nil t) + (add-hook 'pre-command-hook 'yas/pre-command-handler t t) + + (push `(apply yas/take-care-of-redo ,beg ,end ,snippet) + buffer-undo-list)))) + +(defun yas/snippet-create (begin end) + "Creates a snippet from an template inserted between BEGIN and END. + +Returns the newly created snippet." + (let ((snippet (yas/make-snippet))) + (goto-char begin) + (yas/snippet-parse-create snippet) + + ;; Sort and link each field + (yas/snippet-sort-fields snippet) + + ;; Create keymap overlay for snippet + (setf (yas/snippet-control-overlay snippet) + (yas/make-control-overlay snippet (point-min) (point-max))) + + ;; Move to end + (goto-char (point-max)) + + ;; Setup hooks + (add-hook 'post-command-hook 'yas/post-command-handler nil t) + (add-hook 'pre-command-hook 'yas/pre-command-handler t t) + + snippet)) + + +;;; Apropos adjacencies: Once the $-constructs bits like "$n" and +;;; "${:n" are deleted in the recently expanded snippet, we might +;;; actually have many fields, mirrors (and the snippet exit) in the +;;; very same position in the buffer. Therefore we need to single-link +;;; the fields-or-mirrors-or-exit, which I have called "fom", +;;; according to their original positions in the buffer. +;;; +;;; Then we have operation `yas/advance-end-maybe' and +;;; `yas/advance-start-maybe', which conditionally push the starts and +;;; ends of these foms down the chain. +;;; +;;; This allows for like the printf with the magic ",": +;;; +;;; printf ("${1:%s}\\n"${1:$(if (string-match "%" text) "," "\);")} \ +;;; $2${1:$(if (string-match "%" text) "\);" "")}$0 +;;; + +(defun yas/fom-start (fom) + (cond ((yas/field-p fom) + (yas/field-start fom)) + ((yas/mirror-p fom) + (yas/mirror-start fom)) + (t + (yas/exit-marker fom)))) + +(defun yas/fom-end (fom) + (cond ((yas/field-p fom) + (yas/field-end fom)) + ((yas/mirror-p fom) + (yas/mirror-end fom)) + (t + (yas/exit-marker fom)))) + +(defun yas/fom-next (fom) + (cond ((yas/field-p fom) + (yas/field-next fom)) + ((yas/mirror-p fom) + (yas/mirror-next fom)) + (t + (yas/exit-next fom)))) + +(defun yas/calculate-adjacencies (snippet) + "Calculate adjacencies for fields or mirrors of SNIPPET. + +This is according to their relative positions in the buffer, and +has to be called before the $-constructs are deleted." + (flet ((yas/fom-set-next-fom (fom nextfom) + (cond ((yas/field-p fom) + (setf (yas/field-next fom) nextfom)) + ((yas/mirror-p fom) + (setf (yas/mirror-next fom) nextfom)) + (t + (setf (yas/exit-next fom) nextfom)))) + (yas/compare-fom-begs (fom1 fom2) + (> (yas/fom-start fom2) (yas/fom-start fom1))) + (yas/link-foms (fom1 fom2) + (yas/fom-set-next-fom fom1 fom2))) + ;; make some yas/field, yas/mirror and yas/exit soup + (let ((soup)) + (when (yas/snippet-exit snippet) + (push (yas/snippet-exit snippet) soup)) + (dolist (field (yas/snippet-fields snippet)) + (push field soup) + (dolist (mirror (yas/field-mirrors field)) + (push mirror soup))) + (setq soup + (sort soup + #'yas/compare-fom-begs)) + (when soup + (reduce #'yas/link-foms soup))))) + +(defun yas/advance-end-maybe (fom newend) + "Maybe advance FOM's end to NEWEND if it needs it. + +If it does, also: + +* call `yas/advance-start-maybe' on FOM's next fom. + +* in case FOM is field call `yas/advance-end-maybe' on its parent + field" + (when (and fom (< (yas/fom-end fom) newend)) + (set-marker (yas/fom-end fom) newend) + (yas/advance-start-maybe (yas/fom-next fom) newend) + (if (and (yas/field-p fom) + (yas/field-parent-field fom)) + (yas/advance-end-maybe (yas/field-parent-field fom) newend)))) + +(defun yas/advance-start-maybe (fom newstart) + "Maybe advance FOM's start to NEWSTART if it needs it. + +If it does, also call `yas/advance-end-maybe' on FOM." + (when (and fom (< (yas/fom-start fom) newstart)) + (set-marker (yas/fom-start fom) newstart) + (yas/advance-end-maybe fom newstart))) + +(defvar yas/dollar-regions nil + "When expanding the snippet the \"parse-create\" functions add + cons cells to this var") + +(defun yas/snippet-parse-create (snippet) + "Parse a recently inserted snippet template, creating all +necessary fields, mirrors and exit points. + +Meant to be called in a narrowed buffer, does various passes" + (let ((parse-start (point))) + ;; Reset the yas/dollar-regions + ;; + (setq yas/dollar-regions nil) + ;; protect escaped quote, backquotes and backslashes + ;; + (yas/protect-escapes nil '(?\\ ?` ?')) + ;; replace all backquoted expressions + ;; + (goto-char parse-start) + (yas/replace-backquotes) + ;; protect escapes again since previous steps might have generated + ;; more characters needing escaping + ;; + (goto-char parse-start) + (yas/protect-escapes) + ;; parse fields with {} + ;; + (goto-char parse-start) + (yas/field-parse-create snippet) + ;; parse simple mirrors and fields + ;; + (goto-char parse-start) + (yas/simple-mirror-parse-create snippet) + ;; parse mirror transforms + ;; + (goto-char parse-start) + (yas/transform-mirror-parse-create snippet) + ;; calculate adjacencies of fields and mirrors + ;; + (yas/calculate-adjacencies snippet) + ;; Delete $-constructs + ;; + (yas/delete-regions yas/dollar-regions) + ;; restore escapes + ;; + (goto-char parse-start) + (yas/restore-escapes) + ;; update mirrors for the first time + ;; + (yas/update-mirrors snippet) + ;; indent the best we can + ;; + (goto-char parse-start) + (yas/indent snippet))) + +(defun yas/indent-according-to-mode (snippet-markers) + "Indent current line according to mode, preserving +SNIPPET-MARKERS." + ;; XXX: Here seems to be the indent problem: + ;; + ;; `indent-according-to-mode' uses whatever + ;; `indent-line-function' is available. Some + ;; implementations of these functions delete text + ;; before they insert. If there happens to be a marker + ;; just after the text being deleted, the insertion + ;; actually happens after the marker, which misplaces + ;; it. + ;; + ;; This would also happen if we had used overlays with + ;; the `front-advance' property set to nil. + ;; + ;; This is why I have these `trouble-markers', they are the ones at + ;; they are the ones at the first non-whitespace char at the line + ;; (i.e. at `yas/real-line-beginning'. After indentation takes place + ;; we should be at the correct to restore them to. All other + ;; non-trouble-markers have been *pushed* and don't need special + ;; attention. + ;; + (goto-char (yas/real-line-beginning)) + (let ((trouble-markers (remove-if-not #'(lambda (marker) + (= marker (point))) + snippet-markers))) + (save-restriction + (widen) + (condition-case err + (indent-according-to-mode) + (error (message "[yas] warning: yas/indent-according-to-mode habing problems running %s" indent-line-function) + nil))) + (mapc #'(lambda (marker) + (set-marker marker (point))) + trouble-markers))) + +(defun yas/indent (snippet) + (let ((snippet-markers (yas/collect-snippet-markers snippet))) + ;; Look for those $> + (save-excursion + (while (re-search-forward "$>" nil t) + (delete-region (match-beginning 0) (match-end 0)) + (when (not (eq yas/indent-line 'auto)) + (yas/indent-according-to-mode snippet-markers)))) + ;; Now do stuff for 'fixed and 'auto + (save-excursion + (cond ((eq yas/indent-line 'fixed) + (while (and (zerop (forward-line)) + (zerop (current-column))) + (indent-to-column column))) + ((eq yas/indent-line 'auto) + (let ((end (set-marker (make-marker) (point-max))) + (indent-first-line-p yas/also-auto-indent-first-line)) + (while (and (zerop (if indent-first-line-p + (prog1 + (forward-line 0) + (setq indent-first-line-p nil)) + (forward-line 1))) + (not (eobp)) + (<= (point) end)) + (yas/indent-according-to-mode snippet-markers)))) + (t + nil))))) + +(defun yas/collect-snippet-markers (snippet) + "Make a list of all the markers used by SNIPPET." + (let (markers) + (dolist (field (yas/snippet-fields snippet)) + (push (yas/field-start field) markers) + (push (yas/field-end field) markers) + (dolist (mirror (yas/field-mirrors field)) + (push (yas/mirror-start mirror) markers) + (push (yas/mirror-end mirror) markers))) + (let ((snippet-exit (yas/snippet-exit snippet))) + (when (and snippet-exit + (marker-buffer (yas/exit-marker snippet-exit))) + (push (yas/exit-marker snippet-exit) markers))) + markers)) + +(defun yas/real-line-beginning () + (let ((c (char-after (line-beginning-position))) + (n (line-beginning-position))) + (while (or (eql c ?\ ) + (eql c ?\t)) + (incf n) + (setq c (char-after n))) + n)) + +(defun yas/escape-string (escaped) + (concat "YASESCAPE" (format "%d" escaped) "PROTECTGUARD")) + +(defun yas/protect-escapes (&optional text escaped) + "Protect all escaped characters with their numeric ASCII value. + +With optional string TEXT do it in string instead of buffer." + (let ((changed-text text) + (text-provided-p text)) + (mapc #'(lambda (escaped) + (setq changed-text + (yas/replace-all (concat "\\" (char-to-string escaped)) + (yas/escape-string escaped) + (when text-provided-p changed-text)))) + (or escaped yas/escaped-characters)) + changed-text)) + +(defun yas/restore-escapes (&optional text escaped) + "Restore all escaped characters from their numeric ASCII value. + +With optional string TEXT do it in string instead of the buffer." + (let ((changed-text text) + (text-provided-p text)) + (mapc #'(lambda (escaped) + (setq changed-text + (yas/replace-all (yas/escape-string escaped) + (char-to-string escaped) + (when text-provided-p changed-text)))) + (or escaped yas/escaped-characters)) + changed-text)) + +(defun yas/replace-backquotes () + "Replace all the \"`(lisp-expression)`\"-style expression + with their evaluated value" + (while (re-search-forward yas/backquote-lisp-expression-regexp nil t) + (let ((transformed (yas/read-and-eval-string (yas/restore-escapes (match-string 1))))) + (goto-char (match-end 0)) + (when transformed (insert transformed)) + (delete-region (match-beginning 0) (match-end 0))))) + +(defun yas/scan-sexps (from count) + (condition-case err + (with-syntax-table (standard-syntax-table) + (scan-sexps from count)) + (error + nil))) + +(defun yas/make-marker (pos) + "Create a marker at POS with `nil' `marker-insertion-type'" + (let ((marker (set-marker (make-marker) pos))) + (set-marker-insertion-type marker nil) + marker)) + +(defun yas/field-parse-create (snippet &optional parent-field) + "Parse most field expressions, except for the simple one \"$n\". + +The following count as a field: + +* \"${n: text}\", for a numbered field with default text, as long as N is not 0; + +* \"${n: text$(expression)}, the same with a lisp expression; + this is caught with the curiously named `yas/multi-dollar-lisp-expression-regexp' + +* the same as above but unnumbered, (no N:) and number is calculated automatically. + +When multiple expressions are found, only the last one counts." + ;; + (save-excursion + (while (re-search-forward yas/field-regexp nil t) + (let* ((real-match-end-0 (yas/scan-sexps (1+ (match-beginning 0)) 1)) + (number (and (match-string-no-properties 1) + (string-to-number (match-string-no-properties 1)))) + (brand-new-field (and real-match-end-0 + ;; break if on "$(" immediately + ;; after the ":", this will be + ;; caught as a mirror with + ;; transform later. + (not (save-match-data + (eq (string-match "$[ \t\n]*(" + (match-string-no-properties 2)) 0))) + (not (and number (zerop number))) + (yas/make-field number + (yas/make-marker (match-beginning 2)) + (yas/make-marker (1- real-match-end-0)) + parent-field)))) + (when brand-new-field + (goto-char real-match-end-0) + (push (cons (1- real-match-end-0) real-match-end-0) + yas/dollar-regions) + (push (cons (match-beginning 0) (match-beginning 2)) + yas/dollar-regions) + (push brand-new-field (yas/snippet-fields snippet)) + (save-excursion + (save-restriction + (narrow-to-region (yas/field-start brand-new-field) (yas/field-end brand-new-field)) + (goto-char (point-min)) + (yas/field-parse-create snippet brand-new-field))))))) + ;; if we entered from a parent field, now search for the + ;; `yas/multi-dollar-lisp-expression-regexp'. THis is used for + ;; primary field transformations + ;; + (when parent-field + (save-excursion + (while (re-search-forward yas/multi-dollar-lisp-expression-regexp nil t) + (let* ((real-match-end-1 (yas/scan-sexps (match-beginning 1) 1))) + ;; commit the primary field transformation if we don't find + ;; it in yas/dollar-regions (a subnested field) might have + ;; already caught it. + (when (and real-match-end-1 + (not (member (cons (match-beginning 0) + real-match-end-1) + yas/dollar-regions))) + (let ((lisp-expression-string (buffer-substring-no-properties (match-beginning 1) + real-match-end-1))) + (setf (yas/field-transform parent-field) (yas/restore-escapes lisp-expression-string))) + (push (cons (match-beginning 0) real-match-end-1) + yas/dollar-regions))))))) + +(defun yas/transform-mirror-parse-create (snippet) + "Parse the \"${n:$(lisp-expression)}\" mirror transformations." + (while (re-search-forward yas/transform-mirror-regexp nil t) + (let* ((real-match-end-0 (yas/scan-sexps (1+ (match-beginning 0)) 1)) + (number (string-to-number (match-string-no-properties 1))) + (field (and number + (not (zerop number)) + (yas/snippet-find-field snippet number)))) + (when (and real-match-end-0 + field) + (push (yas/make-mirror (yas/make-marker (match-beginning 0)) + (yas/make-marker (match-beginning 0)) + (yas/restore-escapes + (buffer-substring-no-properties (match-beginning 2) + (1- real-match-end-0)))) + (yas/field-mirrors field)) + (push (cons (match-beginning 0) real-match-end-0) yas/dollar-regions))))) + +(defun yas/simple-mirror-parse-create (snippet) + "Parse the simple \"$n\" mirrors and the exit-marker." + (while (re-search-forward yas/simple-mirror-regexp nil t) + (let ((number (string-to-number (match-string-no-properties 1)))) + (cond ((zerop number) + + (setf (yas/snippet-exit snippet) + (yas/make-exit (yas/make-marker (match-end 0)))) + (save-excursion + (goto-char (match-beginning 0)) + (when yas/wrap-around-region + (cond (yas/selected-text + (insert yas/selected-text)) + ((and (eq yas/wrap-around-region 'cua) + cua-mode + (get-register ?0)) + (insert (prog1 (get-register ?0) + (set-register ?0 nil)))))) + (push (cons (point) (yas/exit-marker (yas/snippet-exit snippet))) + yas/dollar-regions))) + (t + (let ((field (yas/snippet-find-field snippet number))) + (if field + (push (yas/make-mirror (yas/make-marker (match-beginning 0)) + (yas/make-marker (match-beginning 0)) + nil) + (yas/field-mirrors field)) + (push (yas/make-field number + (yas/make-marker (match-beginning 0)) + (yas/make-marker (match-beginning 0)) + nil) + (yas/snippet-fields snippet)))) + (push (cons (match-beginning 0) (match-end 0)) + yas/dollar-regions)))))) + +(defun yas/delete-regions (regions) + "Sort disjuct REGIONS by start point, then delete from the back." + (mapc #'(lambda (reg) + (delete-region (car reg) (cdr reg))) + (sort regions + #'(lambda (r1 r2) + (>= (car r1) (car r2)))))) + +(defun yas/update-mirrors (snippet) + "Updates all the mirrors of SNIPPET." + (save-excursion + (dolist (field (yas/snippet-fields snippet)) + (dolist (mirror (yas/field-mirrors field)) + ;; stacked expansion: I added an `inhibit-modification-hooks' + ;; here, for safety, may need to remove if we the mechanism is + ;; altered. + ;; + (let ((inhibit-modification-hooks t)) + (yas/mirror-update-display mirror field) + ;; `yas/place-overlays' is needed if the active field and + ;; protected overlays have been changed because of insertions + ;; in `yas/mirror-update-display' + ;; + (when (eq field (yas/snippet-active-field snippet)) + (yas/place-overlays snippet field))))))) + +(defun yas/mirror-update-display (mirror field) + "Update MIRROR according to FIELD (and mirror transform)." + (let ((reflection (or (yas/apply-transform mirror field) + (yas/field-text-for-display field)))) + (when (and reflection + (not (string= reflection (buffer-substring-no-properties (yas/mirror-start mirror) + (yas/mirror-end mirror))))) + (goto-char (yas/mirror-start mirror)) + (insert reflection) + (if (> (yas/mirror-end mirror) (point)) + (delete-region (point) (yas/mirror-end mirror)) + (set-marker (yas/mirror-end mirror) (point)) + (yas/advance-start-maybe (yas/mirror-next mirror) (point)))))) + +(defun yas/field-update-display (field snippet) + "Much like `yas/mirror-update-display', but for fields" + (when (yas/field-transform field) + (let ((inhibit-modification-hooks t) + (transformed (yas/apply-transform field field)) + (point (point))) + (when (and transformed + (not (string= transformed (buffer-substring-no-properties (yas/field-start field) + (yas/field-end field))))) + (setf (yas/field-modified-p field) t) + (goto-char (yas/field-start field)) + (insert transformed) + (if (> (yas/field-end field) (point)) + (delete-region (point) (yas/field-end field)) + (set-marker (yas/field-end field) (point)) + (yas/advance-start-maybe (yas/field-next field) (point))) + t)))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Pre- and post-command hooks +;; +(defun yas/pre-command-handler () ) + +(defun yas/post-command-handler () + "Handles various yasnippet conditions after each command." + (cond (yas/protection-violation + (goto-char yas/protection-violation) + (setq yas/protection-violation nil)) + ((eq 'undo this-command) + ;; + ;; After undo revival the correct field is sometimes not + ;; restored correctly, this condition handles that + ;; + (let* ((snippet (car (yas/snippets-at-point))) + (target-field (and snippet + (find-if-not #'(lambda (field) + (yas/field-probably-deleted-p snippet field)) + (remove nil + (cons (yas/snippet-active-field snippet) + (yas/snippet-fields snippet))))))) + (when target-field + (yas/move-to-field snippet target-field)))) + ((not (yas/undo-in-progress)) + ;; When not in an undo, check if we must commit the snippet (use exited it). + (yas/check-commit-snippet)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Debug functions. Use (or change) at will whenever needed. +;; +;; some useful debug code for looking up snippet tables +;; +;; (insert (pp +;; (let ((shit)) +;; (maphash #'(lambda (k v) +;; (push k shit)) +;; (yas/snippet-table-hash (gethash 'ruby-mode yas/snippet-tables))) +;; shit))) +;; + +(defun yas/debug-tables () + (interactive) + (with-output-to-temp-buffer "*YASnippet tables*" + (dolist (symbol (remove nil (append (list major-mode) + (if (listp yas/mode-symbol) + yas/mode-symbol + (list yas/mode-symbol))))) + (princ (format "Snippet table hash keys for %s:\n\n" symbol)) + (let ((keys)) + (maphash #'(lambda (k v) + (push k keys)) + (yas/snippet-table-hash (gethash symbol yas/snippet-tables))) + (princ keys)) + + (princ (format "Keymap for %s:\n\n" symbol)) + (princ (gethash symbol yas/menu-table))))) + +(defun yas/debug-snippet-vars () + "Debug snippets, fields, mirrors and the `buffer-undo-list'." + (interactive) + (with-output-to-temp-buffer "*YASnippet trace*" + (princ "Interesting YASnippet vars: \n\n") + + (princ (format "\nPost command hook: %s\n" post-command-hook)) + (princ (format "\nPre command hook: %s\n" pre-command-hook)) + + (princ (format "%s live snippets in total\n" (length (yas/snippets-at-point (quote all-snippets))))) + (princ (format "%s overlays in buffer:\n\n" (length (overlays-in (point-min) (point-max))))) + (princ (format "%s live snippets at point:\n\n" (length (yas/snippets-at-point)))) + + + (dolist (snippet (yas/snippets-at-point)) + (princ (format "\tsid: %d control overlay from %d to %d\n" + (yas/snippet-id snippet) + (overlay-start (yas/snippet-control-overlay snippet)) + (overlay-end (yas/snippet-control-overlay snippet)))) + (princ (format "\tactive field: %d from %s to %s covering \"%s\"\n" + (yas/field-number (yas/snippet-active-field snippet)) + (marker-position (yas/field-start (yas/snippet-active-field snippet))) + (marker-position (yas/field-end (yas/snippet-active-field snippet))) + (buffer-substring-no-properties (yas/field-start (yas/snippet-active-field snippet)) (yas/field-end (yas/snippet-active-field snippet))))) + (when (yas/snippet-exit snippet) + (princ (format "\tsnippet-exit: at %s next: %s\n" + (yas/exit-marker (yas/snippet-exit snippet)) + (yas/exit-next (yas/snippet-exit snippet))))) + (dolist (field (yas/snippet-fields snippet)) + (princ (format "\tfield: %d from %s to %s covering \"%s\" next: %s\n" + (yas/field-number field) + (marker-position (yas/field-start field)) + (marker-position (yas/field-end field)) + (buffer-substring-no-properties (yas/field-start field) (yas/field-end field)) + (yas/debug-format-fom-concise (yas/field-next field)))) + (dolist (mirror (yas/field-mirrors field)) + (princ (format "\t\tmirror: from %s to %s covering \"%s\" next: %s\n" + (marker-position (yas/mirror-start mirror)) + (marker-position (yas/mirror-end mirror)) + (buffer-substring-no-properties (yas/mirror-start mirror) (yas/mirror-end mirror)) + (yas/debug-format-fom-concise (yas/mirror-next mirror))))))) + + (princ (format "\nUndo is %s and point-max is %s.\n" + (if (eq buffer-undo-list t) + "DISABLED" + "ENABLED") + (point-max))) + (unless (eq buffer-undo-list t) + (princ (format "Undpolist has %s elements. First 10 elements follow:\n" (length buffer-undo-list))) + (let ((first-ten (subseq buffer-undo-list 0 19))) + (dolist (undo-elem first-ten) + (princ (format "%2s: %s\n" (position undo-elem first-ten) (truncate-string-to-width (format "%s" undo-elem) 70)))))))) + +(defun yas/debug-format-fom-concise (fom) + (when fom + (cond ((yas/field-p fom) + (format "field %d from %d to %d" + (yas/field-number fom) + (marker-position (yas/field-start fom)) + (marker-position (yas/field-end fom)))) + ((yas/mirror-p fom) + (format "mirror from %d to %d" + (marker-position (yas/mirror-start fom)) + (marker-position (yas/mirror-end fom)))) + (t + (format "snippet exit at %d" + (marker-position (yas/fom-start fom))))))) + + +(defun yas/exterminate-package () + (interactive) + (yas/global-mode -1) + (yas/minor-mode -1) + (yas/kill-snippet-keybindings) + (mapatoms #'(lambda (atom) + (when (string-match "yas/" (symbol-name atom)) + (unintern atom))))) + +(defun yas/debug-test (&optional quiet) + (interactive "P") + (yas/load-directory (or (and (listp yas/root-directory) + (first yas/root-directory)) + yas/root-directory + "~/Source/yasnippet/snippets/")) + (set-buffer (switch-to-buffer "*YAS TEST*")) + (mapc #'yas/commit-snippet (yas/snippets-at-point 'all-snippets)) + (erase-buffer) + (setq buffer-undo-list nil) + (setq undo-in-progress nil) + (snippet-mode) + (yas/minor-mode 1) + (let ((abbrev)) + (setq abbrev "$f") + (insert abbrev)) + (unless quiet + (add-hook 'post-command-hook 'yas/debug-snippet-vars 't 'local))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; `locate-dominating-file' is added for compatibility in emacs < 23 +(unless (or (eq emacs-major-version 23) + (fboundp 'locate-dominating-file)) + (defvar locate-dominating-stop-dir-regexp + "\\`\\(?:[\\/][\\/][^\\/]+[\\/]\\|/\\(?:net\\|afs\\|\\.\\.\\.\\)/\\)\\'" + "Regexp of directory names which stop the search in `locate-dominating-file'. +Any directory whose name matches this regexp will be treated like +a kind of root directory by `locate-dominating-file' which will stop its search +when it bumps into it. +The default regexp prevents fruitless and time-consuming attempts to find +special files in directories in which filenames are interpreted as hostnames, +or mount points potentially requiring authentication as a different user.") + + (defun locate-dominating-file (file name) + "Look up the directory hierarchy from FILE for a file named NAME. +Stop at the first parent directory containing a file NAME, +and return the directory. Return nil if not found." + ;; We used to use the above locate-dominating-files code, but the + ;; directory-files call is very costly, so we're much better off doing + ;; multiple calls using the code in here. + ;; + ;; Represent /home/luser/foo as ~/foo so that we don't try to look for + ;; `name' in /home or in /. + (setq file (abbreviate-file-name file)) + (let ((root nil) + (prev-file file) + ;; `user' is not initialized outside the loop because + ;; `file' may not exist, so we may have to walk up part of the + ;; hierarchy before we find the "initial UID". + (user nil) + try) + (while (not (or root + (null file) + ;; FIXME: Disabled this heuristic because it is sometimes + ;; inappropriate. + ;; As a heuristic, we stop looking up the hierarchy of + ;; directories as soon as we find a directory belonging + ;; to another user. This should save us from looking in + ;; things like /net and /afs. This assumes that all the + ;; files inside a project belong to the same user. + ;; (let ((prev-user user)) + ;; (setq user (nth 2 (file-attributes file))) + ;; (and prev-user (not (equal user prev-user)))) + (string-match locate-dominating-stop-dir-regexp file))) + (setq try (file-exists-p (expand-file-name name file))) + (cond (try (setq root file)) + ((equal file (setq prev-file file + file (file-name-directory + (directory-file-name file)))) + (setq file nil)))) + root))) + +(provide 'yasnippet) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Monkey patching for other functions that's causing +;; problems to yasnippet. For details on why I patch +;; those functions, refer to +;; http://code.google.com/p/yasnippet/wiki/MonkeyPatching +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defadvice c-neutralize-syntax-in-CPP + (around yas-mp/c-neutralize-syntax-in-CPP activate) + "Adviced `c-neutralize-syntax-in-CPP' to properly +handle the end-of-buffer error fired in it by calling +`forward-char' at the end of buffer." + (condition-case err + ad-do-it + (error (message (error-message-string err))))) + +;; disable c-electric-* serial command in YAS fields +(add-hook 'c-mode-common-hook + '(lambda () + (dolist (k '(":" ">" ";" "<" "{" "}")) + (define-key (symbol-value (make-local-variable 'yas/keymap)) + k 'self-insert-command)))) + + +;;; 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 @@ +#name : v.begin(), v.end() +# -- +${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 @@ +#name : class ... { ... } +# -- +class ${1:Name} +{ +public: + ${1:$(yas/substr text "[^: ]*")}($2); + virtual ~${1:$(yas/substr text "[^: ]*")}(); +}; \ 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 @@ +#name : namespace ... +# -- +namespace \ 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 @@ +#name : template +# -- +template \ 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 @@ +#name : using namespace ... +# -- +using namespace ${std}; +$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 @@ +#name : FILE *fp = fopen(..., ...); +# -- +FILE *${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 @@ +# -*- mode: snippet -*- +# name : printf +# contributor : joaotavora +# -- +printf ("${1:%s}\\n"${1:$(if (string-match "%" text) "," "\);") +}$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 @@ +#contributor : Alejandro Espinoza Esparza +#name : private attribute ....; +# -- +/// +/// $3 +/// +private $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 @@ +#contributor : Alejandro Espinoza Esparza +#name : private attribute ....; public property ... ... { ... } +# -- +/// +/// $3 +/// +private $1 $2; + +/// +/// $4 +/// +/// $5 +public $1 $2 +{ + get { + return this.$2; + } + set { + this.$2 = value; + } +} 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : private _attribute ....; public Property ... ... { ... } +# -- +/// +/// $3 +/// +private $1 ${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")}; + +/// +/// ${3:Description} +/// +/// $1 +public ${1:Type} ${2:Name} +{ + get { + return this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")}; + } + set { + this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")} = value; + } +} 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : class ... { ... } +# -- +${5:public} class ${1:Name} +{ + #region Ctor & Destructor + /// + /// ${3:Standard Constructor} + /// + public $1($2) + { + } + + /// + /// ${4:Default Destructor} + /// + public ~$1() + { + } + #endregion +} 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : /// ... +# -- +/// +/// $1 +/// 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : /// ... +# -- +/// $2 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : /// ... +# -- +/// $1 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : /// ... +# -- +/// $2 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : public void Method { ... } +# -- +/// +/// ${5:Description} +/// ${2:$(if (string= (upcase text) "VOID") "" (format "%s%s%s" "\n/// " text ""))} +${1:public} ${2:void} ${3:MethodName}($4) +{ +$0 +} 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : namespace .. { ... } +# -- +namespace $1 +{ +$0 +} 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : property ... ... { ... } +# -- +/// +/// $5 +/// +/// $6 +$1 $2 $3 +{ + get { + return this.$4; + } + set { + this.$4 = value; + } +} 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : #region ... #endregion +# -- +#region $1 +$0 +#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 @@ +#contributor : Alejandro Espinoza Esparza +#name : using ...; +# -- +using $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 @@ +#contributor : Alejandro Espinoza Esparza +#name : using System; +# -- +using 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : using System....; +# -- +using 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 @@ +#name : do { ... } while (...) +# -- +do +{ + $0 +} 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 @@ +#name : for (...; ...; ...) { ... } +# -- +for (${1:int i = 0}; ${2:i < N}; ${3:++i}) +{ + $0 +} \ 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 @@ +#name : if (...) { ... } +# -- +if (${1:condition}) +{ + $0 +} \ 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 @@ +#name : #include "..." +# -- +#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 @@ +#name : #include <...> +# -- +#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 @@ +#name: int main(argc, argv) { ... } +# -- +int main(int argc, char *argv[]) +{ + $0 + return 0; +} 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 @@ +#name : foo { ... } ; setFoo { ... } +# -- +- (${1:id})${2:foo} +{ + return $2; +} + +- (void)set${2:$(capitalize text)}:($1)aValue +{ + [$2 autorelease]; + $2 = [aValue retain]; +} +$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 @@ +#name : #ifndef XXX; #define XXX; #endif +# -- +#ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_} +#define $1 + +$0 + +#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 @@ +#name : struct ... { ... } +# -- +struct ${1:name} +{ + $0 +}; \ 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 @@ +#name : background-color: ... +# -- +background-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 @@ +#name : background-image: ... +# -- +background-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 @@ +#name : border size style color +# -- +border: ${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 @@ +#contributor : rejeep +#name : clear: ... +# -- +clear: $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 @@ +#contributor : rejeep +#name : display: block +# -- +display: 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 @@ +#contributor : rejeep +#name : display: inline +# -- +display: 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 @@ +#contributor : rejeep +#name : display: none +# -- +display: 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 @@ +#contributor : rejeep +#name : font-family: ... +# -- +font-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 @@ +#contributor : rejeep +#name : font-size: ... +# -- +font-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 @@ +#contributor : rejeep +#name : margin-bottom: ... +# -- +margin-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 @@ +#contributor : rejeep +#name : margin-left: ... +# -- +margin-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 @@ +#contributor : rejeep +#name : margin: ... +# -- +margin: $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 @@ +#contributor : rejeep +#name : margin top right bottom left +# -- +margin: ${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 @@ +#contributor : rejeep +#name : margin-right: ... +# -- +margin-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 @@ +#contributor : rejeep +#name : margin-top: ... +# -- +margin-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 @@ +#contributor : rejeep +#name : padding-bottom: ... +# -- +padding-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 @@ +#contributor : rejeep +#name : padding-left: ... +# -- +padding-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 @@ +#contributor : rejeep +#name : padding: ... +# -- +padding: $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 @@ +#contributor : rejeep +#name : padding: top right bottom left +# -- +padding: ${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 @@ +#contributor : rejeep +#name : padding-right: ... +# -- +padding-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 @@ +#contributor : rejeep +#name : padding-top: ... +# -- +padding-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 @@ +TITLE: Emacs Idiom Template Set. Version 1. 2009-02-22 + +DESCRIPTION: Some useful templates for emacs lisp. This template set is based on useful elisp idioms on common tasks. + +LICENSING: GPL version 3. + +AUTHOR: Xah Lee + +Home Page: latest version at: +• Emacs Lisp Idiom Templates + 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 @@ +#name : function template +#contributor : Xah Lee +# -- +(defun $1 () + "thisandthat." + (interactive) + (let (var1) + (setq var1 some) + $0 + ) +) \ 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 @@ +#name : process marked files in dired +#contributor : Xah Lee +# -- +;; idiom for processing a list of files in dired's marked files + +;; suppose myProcessFile is your function that takes a file path +;; and do some processing on the file + +(defun dired-myProcessFile () + "apply myProcessFile function to marked files in dired." + (interactive) + (require 'dired) + (mapc 'myProcessFile (dired-get-marked-files)) +) + +;; 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 @@ +#name : a function that process a file +#contributor : Xah Lee +# -- +(defun doThisFile (fpath) + "Process the file at path FPATH ..." + (let () + ;; create temp buffer without undo record or font lock. (more efficient) + ;; first space in temp buff name is necessary + (set-buffer (get-buffer-create " myTemp")) + (insert-file-contents fpath nil nil nil t) + + ;; process it ... + ;; (goto-char 0) ; move to begining of file's content (in case it was open) + ;; ... do something here + ;; (write-file fpath) ;; write back to the file + + (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 @@ +#name : read lines of a file +#contributor : Xah Lee +# -- +(defun read-lines (filePath) + "Return a list of lines in FILEPATH." + (with-temp-buffer + (insert-file-contents filePath) + (split-string + (buffer-string) "\n" t)) ) + +;; process all lines +(mapc + (lambda (aLine) + (message aLine) ; do your stuff here + ) + (read-lines "inputFilePath") +) \ 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 @@ +#name : find and replace on region +#contributor : Xah Lee +# -- +(defun replace-html-chars-region (start end) + "Replace “<” to “<” and other chars in HTML. +This works on the current region." + (interactive "r") + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (while (search-forward "&" nil t) (replace-match "&" nil t)) + (goto-char (point-min)) + (while (search-forward "<" nil t) (replace-match "<" nil t)) + (goto-char (point-min)) + (while (search-forward ">" nil t) (replace-match ">" nil t)) + ) + ) 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 @@ +#name : grab buffer substring +#contributor : Xah Lee +# -- +(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 @@ +#name : grab word under cursor +#contributor : Xah Lee +# -- +(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 @@ +#name : traversing a directory +#contributor : Xah Lee +# -- +;; apply a function to all files in a dir +(require 'find-lisp) +(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 @@ +#name : Command that works on region or word +#contributor : Xah Lee +# -- +;; example of a command that works on current word or text selection +(defun down-case-word-or-region () + "Lower case the current word or text selection." +(interactive) +(let (pos1 pos2 meat) + (if (and transient-mark-mode mark-active) + (setq pos1 (region-beginning) + pos2 (region-end)) + (setq pos1 (car (bounds-of-thing-at-point 'symbol)) + pos2 (cdr (bounds-of-thing-at-point 'symbol)))) + + ; now, pos1 and pos2 are the starting and ending positions + ; of the current word, or current text selection if exists + + ;; put your code here. + $0 + ;; Some example of things you might want to do + (downcase-region pos1 pos2) ; example of a func that takes region as args + (setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text. + (delete-region pos1 pos2) ; get rid of it + (insert "newText") ; insert your new text + + ) +) 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 @@ +#name : (user's email) +# -- +`(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 @@ +#name : after ... -> +# -- +after + $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 @@ +#name : begin ... end +# -- +begin + $0 +end 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 @@ +#name : -behaviour(...). +# -- +-behaviour(${1:gen_server}). +$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 @@ +#name : case ... of ... end +# -- +case $1 of + $0 +end 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 @@ +#name : -compile(...). +# -- +-compile([${1:export_all}]). +$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 @@ +#name : -define(...,...). +# -- +-define($1,$2). +$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 @@ +#name : -export([]). +#contributor : hitesh +# -- +-export([${1:start/0}]). +$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 @@ +#name : fun (...) -> ... end +# -- +fun ($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 @@ +#name : if ... -> ... ; true -> ... end +# -- +if + $1 -> $2; + true -> $0 +end 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 @@ +#name : -ifdef(...). ... -endif. +# -- +-ifdef($1). +$0 +-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 @@ +#name : -ifndef(...). ... -endif. +# -- +-ifndef($1). +$0 +-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 @@ +#name : -import([]). +#contributor : hitesh +# -- +-import(${1:lists}, [${2:map/2, sum/1}]). +$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 @@ +#name : -include("..."). +# -- +-include("$1"). +$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 @@ +#name : -include_lib("..."). +# -- +-include_lib("$1"). +$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 @@ +#name : loop(...) -> receive _ -> loop(...) end. +# -- +${1:loop}($2) -> + receive + ${3:_} -> + $1($2) + end. +$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 @@ +#name : -module(). +#contributor : hitesh +# -- +-module(${1:`(file-name-nondirectory + (file-name-sans-extension (or (buffer-file-name) (buffer-name))))`}). +$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 @@ +#name : receive ... -> ... end +# -- +receive + $1 -> $0 +end 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 @@ +#name : receive after ... -> ... end +# -- +receive +after + $1 -> $0 +end 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 @@ +#name : -record(...,{...}). +# -- +-record($1,{$2}). +$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 @@ +#name : try ... of ... catch after end +# -- +try $1 of + $0 +catch +after +end 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 @@ +#name : -undef(...). +# -- +-undef($1). +$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 @@ +#contributor: Li Zhu +#name : automatic +# -- +automatic $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 @@ +#contributor: Li Zhu +#name : block data +# -- +block 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 @@ +#contributor: Li Zhu +#name : continue +# -- +continue $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 @@ +#contributor: Li Zhu +#name : character +# -- +character $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 @@ +#contributor: Li Zhu +#name : complex +# -- +complex $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 @@ +#contributor: Li Zhu +#name : double complex +# -- +double 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 @@ +#contributor: Li Zhu +#name : do while (...) end do +# -- +do while (${1:condition}) + $0 +end 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 @@ +#contributor: Li Zhu +#name : double precision +# -- +double 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 @@ +#contributor: Li Zhu +#name : equivalence +# -- +equivalence $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 @@ +#contributor: Li Zhu +#name : implicit byte +# -- +implicit 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 @@ +#contributor: Li Zhu +#name : implicit complex +# -- +implicit 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 @@ +#contributor: Li Zhu +#name : implicit character +# -- +implicit 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 @@ +#contributor: Li Zhu +#name : if then end if +# -- +if ( ${1:condition} ) then + $0 +end 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 @@ +#contributor: Li Zhu +#name : implicit integer +# -- +implicit 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 @@ +#contributor: Li Zhu +#name : implicit logical +# -- +implicit 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 @@ +#contributor: Li Zhu +#name : implicit none +# -- +implicit 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 @@ +#contributor: Li Zhu +#name : include +# -- +include $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 @@ +#contributor: Li Zhu +#name : intrinsic +# -- +intrinsic $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 @@ +#contributor: Li Zhu +#name : implicit real +# -- +implicit 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 @@ +#contributor: Li Zhu +#name : logical +# -- +logical $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 @@ +#contributor: Li Zhu +#name : parameter +# -- +parameter $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 @@ +#contributor: Li Zhu +#name : program ... end program ... +# -- +program ${1:name} + $0 +end 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 @@ +#contributor: Li Zhu +#name : read (*,*) +# -- +read (${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 @@ +#contributor: Li Zhu +#name : structure +# -- +structure $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 @@ +#contributor: Li Zhu +#name : subroutine +# -- +subroutine $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 @@ +#contributor: Li Zhu +#name : write (*,*) +# -- +write (${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 @@ +#contributor : Jimmy Wu +#name : ... +# -- + + $0 + \ 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 @@ +#contributor : Jimmy Wu +#name :
+# -- +
\ 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- + + $0 + \ 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- + + $0 + \ 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 @@ +#contributor : Rodrigo Setti +#name :
...
+#group : list +# -- +
$1
\ 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 @@ +#name : ... +# -- +$0 \ 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 @@ +#contributor : Jimmy Wu +#name :
...
+# -- +
+ $0 +
\ 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 @@ +#contributor : Jimmy Wu +#name :
...
+# -- +
+ $0 +
\ 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 @@ +#contributor : Jimmy Wu +#name :
...
+# -- +
+ $0 +
\ 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 @@ +#contributor : Rodrigo Setti +#name :
...
+#group : list +# -- +
+ $0 +
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 @@ +#contributor : Rodrigo Setti +#name :
...
+#group : list +# -- +
+ $0 +
\ 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 @@ +#name : Doctype HTML 4.01 Strict +#group : meta +# -- + \ 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 @@ +#name : DocType XHTML 1.0 frameset +#group : meta +# -- + \ 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 @@ +#name : DocType XHTML 1.1 +#group : meta +# -- + \ 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 @@ +#name : DocType XHTML 1.0 Strict +#group : meta +# -- + \ 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 @@ +#name : DocType XHTML 1.0 Transitional +#group : meta +# -- + \ 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 @@ +#name : ... +# -- +a mirror up here $3 + + + + $0 + + + actually some other shit and $3 + 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 @@ +#contributor : Rodrigo Setti +#name :
...
+#group : list +# -- +
$1
\ 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 @@ +#contributor : Jimmy Wu +#name :
+# -- +
+ $0 +
\ 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 @@ +#contributor : Jimmy Wu +#name :

...

+#group : header +# -- +

$1

\ 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 @@ +#contributor : Jimmy Wu +#name :

...

+#group : header +# -- +

$1

\ 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 @@ +#contributor : Jimmy Wu +#name :

...

+#group : header +# -- +

$1

\ 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 @@ +#contributor : Jimmy Wu +#name :

...

+#group : header +# -- +

$1

\ 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 @@ +#contributor : Jimmy Wu +#name :
...
+#group : header +# -- +
$1
\ 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 @@ +#contributor : Jimmy Wu +#name :
...
+#group : header +# -- +
$1
\ 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- + + $0 + \ 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 @@ +#contributor : Jimmy Wu +#name :
+# -- +
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 @@ +#contributor : Jimmy Wu +#name : ... +# -- +$2 \ 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- + + $0 + 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- + + $0 + 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- +$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 @@ +#contributor : Jimmy Wu +#name : +# -- + \ 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 @@ +#contributor : Jimmy Wu +#name :
  • ...
  • +#group : list +# -- +
  • $1
  • \ 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 @@ +#contributor : Jimmy Wu +#name :
  • ...
  • +#group : list +# -- +
  • $2
  • \ 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 @@ +#contributor : Jimmy Wu +#name : +# -- + \ 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 @@ +#contributor : Jimmy Wu +#name : +# -- + \ 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- +$0 \ 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 @@ +#contributor : Jimmy Wu +#group : meta +#name : +# -- + \ 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 @@ +#contributor : Jimmy Wu +#name : +#group : meta +# -- + \ 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 @@ +#contributor : Jimmy Wu +#name :
      ...
    +#group : list +# -- +
      + $0 +
    \ 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 @@ +#contributor : Jimmy Wu +#name :
      ...
    +#group : list +# -- +
      + $0 +
    \ 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 @@ +#contributor : Jimmy Wu +#name :
      ...
    +#group : list +# -- +
      + $0 +
    \ 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 @@ +#contributor : Jimmy Wu +#name :

    ...

    +# -- +

    $1

    \ 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 @@ +#contributor : Jimmy Wu +#name :
    ...
    +# -- +
    +  $0
    +
    \ 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 @@ +#contributor : Jimmy Wu +#name :
    ...
    +# -- +
    + $1 +
    \ 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 @@ +#contributor : Jimmy Wu +#name : +# -- + \ 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 @@ +#contributor : Jimmy Wu +#name : +# -- + \ 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- +$1 \ 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- +$2 \ 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- +$2 \ 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 @@ +#contributor : Jimmy Wu +#name : +# -- + \ 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 @@ +#contributor : Jimmy Wu +#name : ...
    +#group : table +# -- + + $0 +
    \ 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 @@ +#contributor : Jimmy Wu +#name : ... +#group : table +# -- +$2 \ 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 @@ +#contributor : Jimmy Wu +#name : +# -- + \ 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 @@ +#contributor : Jimmy Wu +#name : ... +#group : table +# -- +$2 \ 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 @@ +#contributor : Jimmy Wu +#name : ... +# -- +$1 \ 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 @@ +#contributor : Jimmy Wu +#name : ... +#group : table +# -- + + $0 + \ 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 @@ +#contributor : Jimmy Wu +#name :
      ...
    +#group : list +# -- +
      + $0 +
    \ 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 @@ +#contributor : Jimmy Wu +#name :
      ...
    +#group : list +# -- +
      + $0 +
    \ 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 @@ +#contributor : Jimmy Wu +#name :
      ...
    +#group : list +# -- +
      + $0 +
    \ 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 @@ +#contributor : Rodrigo Setti +#name : \begin{environment} ... \end{environment} +# -- + +\begin{${1:environment}} +$0 +\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 @@ +#name : Unordered List +#contributor: Peng Deng +# -- ++ ${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..9d5c51d --- /dev/null +++ b/.emacs.d/mysnippets/text-mode/markdown-mode/- @@ -0,0 +1,5 @@ +#name : Unordered List +#contributor: Peng Deng +# -- +- ${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..50ab476 --- /dev/null +++ b/.emacs.d/mysnippets/text-mode/markdown-mode/_ @@ -0,0 +1,4 @@ +#name : Emphasis +#contributor: Peng Deng +# -- +_${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 @@ +#name : Strong +#contributor: Peng Deng +# -- +**${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 @@ +#name : Inline Code +#contributor: Peng Deng +# -- +\`${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 @@ +#name : Header 1 (#) +#contributor: Peng Deng +# -- +# ${1:Header 1} # + +$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 @@ +#name : Header 1 (=) +#contributor: Peng Deng +# -- +${1:Header 1} +${1:$(make-string (string-width text) ?\=)} + +$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 @@ +#name : Header 2 (##) +#contributor: Peng Deng +# -- +## ${1:Header 1} ## + +$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 @@ +#name : Header 2 (-) +#contributor: Peng Deng +# -- +${1:Header 2} +${1:$(make-string (string-width text) ?\-)} + +$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 @@ +#name : Header 3 +#contributor: Peng Deng +# -- +### ${1:Header 3} ### + +$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 @@ +#name : Header 4 +#contributor: Peng Deng +# -- +#### ${1:Header 4} #### + +$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 @@ +#name : Header 5 +#contributor: Peng Deng +# -- +##### ${1:Header 5} ##### + +$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 @@ +#name : Header 6 +#contributor: Peng Deng +# -- +###### ${1:Header 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 @@ +#name : Horizontal Rule (-) +#contributor: Peng Deng +# -- + +---------- + +$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 @@ +#name : Horizontal Rule (*) +#contributor: Peng Deng +# -- + +******* + +$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 @@ +#name : Image +#contributor: Peng Deng +# -- +![${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 @@ +#name : Link +#contributor: Peng Deng +# -- +[${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 @@ +#name : Ordered List +#contributor: Peng Deng +# -- +${1:1}. ${2:Text} +${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 @@ +#name : Referenced Image +#contributor: Peng Deng +# -- +![${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 @@ +#name : Reference Label +#contributor: Peng Deng +# -- +[${1:Reference}]: ${2:URL} $3 +$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 @@ +#name : Reference Link +#contributor: Peng Deng +# -- +[${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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
    +# -- +
    \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$0 \ 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 @@ +#contributor : Anders Bach Nielsen +#name : DocType XHTML 1.1 +#group : meta +# -- + \ 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 @@ +#contributor : Anders Bach Nielsen +#name : DocType XHTML 1.0 Strict +#group : meta +# -- + \ 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 @@ +#contributor : Anders Bach Nielsen +#name : DocType XHTML 1.0 Transitional +#group : meta +# -- + \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
    +# -- +
    + $0 +
    \ 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 @@ +#contributor : Anders Bach Nielsen +#name :

    ...

    +#group : header +# -- +

    $1

    \ 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 @@ +#contributor : Anders Bach Nielsen +#name :

    ...

    +#group : header +# -- +

    $1

    \ 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 @@ +#contributor : Anders Bach Nielsen +#name :

    ...

    +#group : header +# -- +

    $1

    \ 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 @@ +#contributor : Anders Bach Nielsen +#name :

    ...

    +#group : header +# -- +

    $1

    \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
    ...
    +#group : header +# -- +
    $1
    \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
    ...
    +#group : header +# -- +
    $1
    \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
    +# -- +
    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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$2 \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$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 @@ +#contributor : Anders Bach Nielsen +#name : +# -- + \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
  • ...
  • +# -- +
  • $1
  • \ 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 @@ +#contributor : Anders Bach Nielsen +#name : +# -- + \ 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 @@ +#contributor : Anders Bach Nielsen +#name : +#group : meta +# -- + \ 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 @@ +#contributor : Anders Bach Nielsen +#name : +# -- + \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
      ...
    +# -- +
      + $0 +
    \ 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 @@ +#contributor : Anders Bach Nielsen +#name :

    ...

    +# -- +

    $1

    \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
    ...
    +# -- +
    +  $0
    +
    \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
    ...
    +# -- +
    + $1 +
    \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$1 \ 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 @@ +#contributor : Anders Bach Nielsen +#name : +# -- + \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ...
    +# -- + + $0 +
    \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +<${1:tag}>$2$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 @@ +#contributor : Anders Bach Nielsen +#name : \n...\n +# -- +<${1:tag}> + $2 +$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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$2 \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$2 \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$1 \ 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 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + \ 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 @@ +#contributor : Anders Bach Nielsen +#name :
      ...
    +# -- +
      + $0 +
    \ 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 @@ +#name : eval { ... } if ($@) { ... } +# -- +eval { + ${1:# do something risky...} +}; +if (\$@) { + ${2:# handle failure...} +} \ 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 @@ +#name : for (...) { ... } +# -- +for (my \$${1:var} = 0; \$$1 < ${2:expression}; \$$1++) { + ${3:# body...} +} \ 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 @@ +#name : foreach ... { ... } +# -- +foreach my \$${1:x} (@${2:array}) { + ${3:# body...} +} \ 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 @@ +#name : if (...) { ... } +# -- +if ($1) { + $0 +} \ 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 @@ +#name : if (...) { ... } else { ... } +# -- +if ($1) { + $2 +} else { + $3 +} \ 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 @@ +#name : if, elsif, else ... +# -- +if ($1) { + ${2:# body...} +} elsif ($3) { + ${4:# elsif...} +} else { + ${5:# else...} +} \ 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 @@ +#name : sub ... { ... } +# -- +sub ${1:function_name} { + $0 +} \ 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 @@ +#name : unless (...) { ... } +# -- +unless ($1) { + $0 +} \ 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 @@ +#name : while (...) { ... } +# -- +while ($1) { + $0 +} \ 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 @@ +#name : ... foreach ... +# -- +${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 @@ +#name : ... if ... +# -- +${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 @@ +#name : ... unless ... +# -- +${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 @@ +#name : ... while ... +# -- +${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 @@ +#name : __...__ +# -- +__${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 @@ +# -*- coding: utf-8 -*- +# name: class +# contributor: Orestis Markou +# contributor: Nishio Hirokazu +# contributor: Yasser González Fernández +# -- +class ${1:ClassName}(${2:object}): + """$3 + """ + + def __init__(self, $4): + """$5 + ${4:$ + (let* ((indent + (concat "\n" (make-string (current-column) 32))) + (args + (mapconcat + '(lambda (x) + (if (not (string= (nth 0 x) "")) + (concat "- " (char-to-string 96) (nth 0 x) + (char-to-string 96) ":"))) + (mapcar + '(lambda (x) + (mapcar + (lambda (x) + (replace-regexp-in-string "[[:blank:]]*$" "" + (replace-regexp-in-string "^[[:blank:]]*" "" x))) x)) + (mapcar '(lambda (x) (split-string x "=")) + (split-string text ","))) + indent))) + (if (string= args "") + (make-string 3 34) + (mapconcat + 'identity + (list "" "Arguments:" args (make-string 3 34)) + indent))) + } + ${4:$ + (mapconcat + '(lambda (x) + (if (not (string= (nth 0 x) "")) + (concat "self._" (nth 0 x) " = " (nth 0 x)))) + (mapcar + '(lambda (x) + (mapcar + '(lambda (x) + (replace-regexp-in-string "[[:blank:]]*$" "" + (replace-regexp-in-string "^[[:blank:]]*" "" x))) + x)) + (mapcar '(lambda (x) (split-string x "=")) + (split-string text ","))) + (concat "\n" (make-string (current-column) 32))) + } + $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 @@ +# -*- coding: utf-8 -*- +# name: def +# contributor: Orestis Markou +# contributor: Yasser González Fernández +# -- +def ${1:name}($2): + """$3 + ${2:$ + (let* + ((indent + (concat "\n" (make-string (current-column) 32))) + (args + (mapconcat + '(lambda (x) + (if (not (string= (nth 0 x) "")) + (concat "- " (char-to-string 96) (nth 0 x) + (char-to-string 96) ":"))) + (mapcar + '(lambda (x) + (mapcar + '(lambda (x) + (replace-regexp-in-string "[[:blank:]]*$" "" + (replace-regexp-in-string "^[[:blank:]]*" "" x))) + x)) + (mapcar '(lambda (x) (split-string x "=")) + (split-string text ","))) + indent))) + (if (string= args "") + (make-string 3 34) + (mapconcat + 'identity + (list "" "Arguments:" args (make-string 3 34)) + indent))) + } + $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 @@ +# -*- coding: utf-8 -*- +# name: defm +# contributor: Yasser Gonz¨¢lez Fern¨¢ndez +# -- +def ${1:name}(self, $2): + """$3 + ${2:$ + (let* ((indent + (concat "\n" (make-string (current-column) 32))) + (args + (mapconcat + '(lambda (x) + (if (not (string= (nth 0 x) "")) + (concat "- " (char-to-string 96) (nth 0 x) + (char-to-string 96) ":"))) + (mapcar + '(lambda (x) + (mapcar + '(lambda (x) + (replace-regexp-in-string "[[:blank:]]*$" "" + (replace-regexp-in-string "^[[:blank:]]*" "" x))) + x)) + (mapcar '(lambda (x) (split-string x "=")) + (split-string text ","))) + indent))) + (if (string= args "") + (make-string 3 34) + (mapconcat + 'identity + (list "" "Arguments:" args (make-string 3 34)) + indent))) + } + $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 @@ +#name : for ... in ... : ... +# -- +for ${var} in ${collection}: + $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 @@ +#name : if __name__ == '__main__': ... +# -- +if __name__ == '__main__': + $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 @@ +# contributor: Mads D. Kristensen +# name: prop +# -- +def ${1:foo}(): + doc = """${2:Doc string}""" + def fget(self): + return self._$1 + def fset(self, value): + self._$1 = value + def fdel(self): + del self._$1 + return locals() +$1 = property(**$1()) + +$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 @@ +#contributor : Julio Carlos Menendez +#name : _get_foo ... foo=property(...) +# -- +def _get_${1:foo}(self): + return self._$1 + +$1 = property(_get_$1) + +$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 @@ +#contributor : Julio Carlos Menendez +#name : _get_foo ... _set_foo ... foo=property(...) +# -- +def _set_${1:foo}(self, value): + self._$1 = value + +def _get_$1(self): + return self._$1 + +$1 = property(_get_$1, _set_$1) + +$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 @@ +#name : while ... : ... +# -- +while ${condition}: + $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 @@ +#name : Chapter title +# -- +${1:Chapter} +${1:$(make-string (string-width text) ?\=)} + +$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 @@ +#name : Section title +# -- +${1:Section} +${1:$(make-string (string-width text) ?\-)} + +$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 @@ +#name : Document title +# -- +${1:$(make-string (string-width text) ?\=)} +${1:Title} +${1:$(make-string (string-width text) ?\=)} + +$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 @@ +#name : # => +#group : general +# -- +# => \ 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 @@ +#name : =begin rdoc ... =end +#group : general +# -- +=begin rdoc + $0 +=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 @@ +#name : include Comparable; def <=> ... end +#group : definitions +# -- +include Comparable + +def <=> other + $0 +end \ 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 @@ +#name : all? { |...| ... } +#group : collections +# -- +all? { |${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 @@ +#name : alias_method new, old +#group : definitions +# -- +alias_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 @@ +#name : any? { |...| ... } +#group : collections +# -- +any? { |${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 @@ +#name : if __FILE__ == $PROGRAM_NAME ... end +#group : general +# -- +if __FILE__ == $PROGRAM_NAME + $0 +end \ 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 @@ +#name : Benchmark.bmbm(...) do ... end +#group : general +# -- +Benchmark.bmbm(${1:10}) do |x| + $0 +end \ 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 @@ +#name : case ... end +#group : general +# -- +case ${1:object} +when ${2:condition} + $0 +end \ 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 @@ +#name : class << self ... end +#group : definitions +# -- +class << ${self} + $0 +end \ 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 @@ +#name : classify { |...| ... } +#group : collections +# -- +classify { |${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 @@ +#name : class ... end +#contributor : hitesh +#group : definitions +# -- +class ${1:`(let ((fn (capitalize (file-name-nondirectory + (file-name-sans-extension + (or (buffer-file-name) + (buffer-name (current-buffer)))))))) + (cond + ((string-match "_" fn) (replace-match "" nil nil fn)) + (t fn)))`} + $0 +end 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 @@ +#name : collect { |...| ... } +#group : collections +# -- +collect { |${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 @@ +#name : deep_copy(...) +#group : general +# -- +Marshal.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 @@ +#name : delete_if { |...| ... } +#group : collections +# -- +delete_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 @@ +#name : detect { |...| ... } +#group : collections +# -- +detect { |${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 @@ +#name : downto(...) { |n| ... } +#group : control structure +# -- +downto(${0}) { |${n}| + $0 +} \ 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 @@ +#name : each { |...| ... } +#group : collections +# -- +each { |${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 @@ +#name : each_cons(...) { |...| ... } +#group : collections +# -- +each_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 @@ +#name : each_index { |i| ... } +#group : collections +# -- +each_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 @@ +#name : each_value { |val| ... } +#group : collections +# -- +each_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 @@ +#name : each_with_index { |e, i| ... } +#group : collections +# -- +each_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 @@ +#name : for ... in ...; ... end +#group : control structure +# -- +for ${1:element} in ${2:collection} + $0 +end \ 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 @@ +#name : if ... end +#group : control structure +# -- +if ${1:condition} + $0 +end \ 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 @@ +#name : if ... else ... end +#group : control structure +# -- +if ${1:condition} + $2 +else + $3 +end \ 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 @@ +#name : inject(...) { |...| ... } +#group : collections +# -- +inject(${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 @@ +#name : def method_missing ... end +#group : definitions +# -- +def method_missing(method, *args) + $0 +end \ 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 @@ +#name : attr_reader ... +#group : definitions +# -- +attr_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 @@ +#name : /usr/bin/ruby -wKU +#group : general +# -- +#!/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 @@ +#name : reject { |...| ... } +#group : collections +# -- +reject { |${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 @@ +#name : require "..." +#group : general +# -- +require "$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 @@ +#name : require File.join(File.dirname(__FILE__), ...) +#group : general +# -- +require 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 @@ +#name : attr_accessor ... +#group : definitions +# -- +attr_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 @@ +#name : select { |...| ... } +#group : collections +# -- +select { |${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 @@ +#name : times { |n| ... } +#group : control structure +# -- +times { |${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 @@ +#name : until ... end +#group: control structure +# -- +until ${condition} + $0 +end \ 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 @@ +#name : upto(...) { |n| ... } +#group : control structure +# -- +upto(${n}) { |${i}| + $0 +} \ 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 @@ +#name : attr_writer ... +#group : definitions +# -- +attr_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 @@ +#name : when ... end +#group : control structure +# -- +when ${condition} + $0 +end \ 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 @@ +#name : while ... end +#group : control structure +# -- +while ${condition} + $0 +end \ 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 @@ +#name : :yields: arguments (rdoc) +#group : general +# -- +: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 @@ +#name : zip(...) { |...| ... } +#group : collections +# -- +zip(${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 @@ +#Author : Jonas Bonèr +#name : def act = { ..} +# -- +def act = { + loop { + react { + $0 + } + } +} \ 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 @@ +#Author : Jonas Bonèr +#name : def act(arg: T) = { ..} +# -- +def act(${1:arg}: ${2:type}) = { + loop { + react { + $0 + } + } +} \ 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 @@ +#Author : Jonas Bonèr +#name : val a = actor { ..} +# -- +val a = actor { + loop { + react { + $0 + } + } +} \ 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 @@ +#Author : Jonas Bonèr +#name : (args) => ... +# -- +($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 @@ +#Author : Anders Bach Nielsen +#name : object name extends Application +# -- +object ${1:name} extends Application { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : Array[T](..) +# -- +Array[${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 @@ +#Author : Jonas Bonèr +#name : val a = Array[T](..) +# -- +val ${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 @@ +#Author : Jonas Bonèr +#name : asInstanceOf[T] +# -- +asInstanceOf[${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 @@ +#Author : Jonas Bonèr +#name : assert(x === y) +# -- +assert(${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 @@ +#Author : Jonas Bonèr +#name : assert(true) +# -- +assert(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 @@ +#Author : Anders Bach Nielsen +#name : @author name +# -- +@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 @@ +#Author : Anders Bach Nielsen +#name : @param name description +# -- +@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 @@ +#Author : Anders Bach Nielsen +#name : @return description +# -- +@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 @@ +#Author : Anders Bach Nielsen +#name : @version number +# -- +@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 @@ +#Author : Jonas Bonèr +#name : actor ! message +# -- +${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 @@ +#Author : Jonas Bonèr +#name : case pattern => +# -- +case ${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 @@ +#Author : Jonas Bonèr +#name : case _ => +# -- +case _ => $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 @@ +#Author : Jonas Bonèr +#name : asInstanceOf[T] +# -- +asInstanceOf[${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 @@ +#Author : Jonas Bonèr +#name : case class T(arg: A) +# -- +case 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 @@ +#Author : Jonas Bonèr +#name : class T { .. } +# -- +class ${1:name} { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : abstract class T { .. } +# -- +abstract class ${1:name} { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : abstract class T(args) { .. } +# -- +abstract class ${1:name}(${2:args}) { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : class T(args) { .. } +# -- +class ${1:name}(${2:args}) { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : classOf[T] +# -- +classOf[${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 @@ +#Author : Jonas Bonèr +#name : case object T +# -- +case 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 @@ +#Author : Jonas Bonèr +#name : element1 :: element2 +# -- +${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 @@ +#Author : Jonas Bonèr +#name : element1 :: Nil +# -- +${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 @@ +#Author : Jonas Bonèr +#name : def f(arg: T) = ... +# -- +def ${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 @@ +#Author : Jonas Bonèr +#name : def f(arg: T) = {...} +# -- +def ${1:name}(${2:args}) = { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : def f(arg: T): R = ... +# -- +def ${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 @@ +#Author : Jonas Bonèr +#name : def f(arg: T): R = {...} +# -- +def ${1:name}(${2:args}): ${3:Unit} = { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : def f = {...} +# -- +def ${1:name} = { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : def f: R = ... +# -- +def ${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 @@ +#Author : Jonas Bonèr +#name : def f: R = {...} +# -- +def ${1:name}: ${3:Unit} = { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : def f = ... +# -- +def ${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 @@ +#Author : Anders Bach Nielsen +#name : /** cls/trt/obj name */ +# -- +/** + * `(scala-mode-find-clstrtobj-name-doc)` + * ${1:description} + * $0 + */ \ 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 @@ +#Author : Anders Bach Nielsen +#name : /** method name */ +# -- +/** + * `(scala-mode-def-and-args-doc)` + */ \ 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 @@ +#Author : Anders Bach Nielsen +#name : /** file name */ +# -- +/** + * `(scala-mode-file-doc)` + * $0 + * @author ${1:name} + * @version ${2:0.1} + */ \ 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 @@ +#Author : Anders Bach Nielsen +#name : /** scala file */ +# -- +/* __ *\ +** ________ ___ / / ___ Scala $3 ** +** / __/ __// _ | / / / _ | (c) 2005-`(format-time-string "%Y")` , LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ +/** + * $0 + * @author ${1:name} + * @version ${2:0.1} + * $Id$ + */ \ 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 @@ +#Author : Anders Bach Nielsen +#name : /** scala api file */ +# -- +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2005-`(format-time-string "%Y")`, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ +/** + * $0 + * @author ${1:name} + * @version ${2:0.1} + * $Id$ + */ \ 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 @@ +#Author : Anders Bach Nielsen +#name : /** ... */ +# -- +/** + * ${1:description} + * $0 + */ \ 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 @@ +#Author : Jonas Bonèr +#name : expect(value) { ..} +# -- +expect(${1:reply}) { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : extends T +# -- +extends $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 @@ +#Author : Jonas Bonèr +#name : x <- xs +# -- +${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 @@ +#Author : Jonas Bonèr +#name : for (x <- xs if guard) { ... } +# -- +for (${1:x} <- ${2:xs} if ${3:guard}) { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : for (x <- xs) { ... } +# -- +for (${1:x} <- ${2:xs}) { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : for {x <- xs \ y <- ys} { yield } +# -- +for { + ${1:x} <- ${2:xs} + ${3:x} <- ${4:xs} +} { + yield $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : foreach(x => ..) +# -- +foreach(${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 @@ +#Author : Jonas Bonèr +#name : new HashMap[K, V] +# -- +new 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 @@ +#Author : Jonas Bonèr +#name : val m = new HashMap[K, V] +# -- +val ${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 @@ +#Author : Jonas Bonèr +#name : new HashSet[K] +# -- +new 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 @@ +#Author : Jonas Bonèr +#name : val m = new HashSet[K] +# -- +val ${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 @@ +#Author : Jonas Bonèr +#name : if (cond) { .. } +# -- +if (${1:condition}) { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : if (cond) { .. } else { .. } +# -- +if (${1:condition}) { + $2 +} else { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : import .. +# -- +import $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 @@ +#Author : Jonas Bonèr +#name : intercept(classOf[T]) { ..} +# -- +intercept(classOf[${1:Exception]}) { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : isInstanceOf[T] +# -- +isInstanceOf[${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 @@ +#Author : Jonas Bonèr +#name : List(..) +# -- +List(${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 @@ +#Author : Jonas Bonèr +#name : val l = List(..) +# -- +val ${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 @@ +#Author : Jonas Bonèr +#name: def main(args: Array[String]) = { ... } +# -- +def main(args: Array[String]) = { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : map(x => ..) +# -- +map(${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 @@ +#Author : Jonas Bonèr +#name : Map(key -> value) +# -- +Map(${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 @@ +#Author : Jonas Bonèr +#name : cc match { .. } +# -- +${1:cc} match { + case ${2:pattern} => $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : can match { case Full(res) => .. } +# -- +${1:option} match { + case Full(res) => $0 + + case Empty => + + case Failure(msg, _, _) => + +} \ 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 @@ +#Author : Jonas Bonèr +#name : option match { case None => .. } +# -- +${1:option} match { + case None => $0 + case Some(res) => + +} \ 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 @@ +#Author : Jonas Bonèr +#name : trait T { .. } +# -- +trait ${1:name} { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : object name extends T +# -- +object ${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 @@ +#Author : Jonas Bonèr +#name : package .. +# -- +package $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 @@ +#Author : Jonas Bonèr +#name : println(..) +# -- +println(${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 @@ +#Author : Jonas Bonèr +#name : print(..) +# -- +print(${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 @@ +#Author : Jonas Bonèr +#name : println("..") +# -- +println("${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 @@ +#Author : Jonas Bonèr +#name : println("obj: " + obj) +# -- +println("${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 @@ +#Author : Jonas Bonèr +#name : private +# -- +private $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 @@ +#Author : Jonas Bonèr +#name : private[this] +# -- +private[${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 @@ +#Author : Jonas Bonèr +#name : protected +# -- +protected $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 @@ +#Author : Jonas Bonèr +#name : protected[this] +# -- +protected[${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 @@ +#Author : Jonas Bonèr +#name : class T extends Suite { .. } +# -- +import org.scalatest._ + +class ${1:name} extends Suite { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : @Test def testX = ... +# -- +//@Test +def test${1:name} = { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : throw new Exception +# -- +throw 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 @@ +#Author : Anders Bach Nielsen +#name : trait T { .. } +# -- +trait ${1:name} { + $0 +} \ 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 @@ +#Author : Anders Bach Nielsen +#name : trait T extends C { .. } +# -- +trait ${1:name} extends ${2:class} { + $0 +} \ 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 @@ +#Author : Anders Bach Nielsen +#name : trait T1 extends C with T2 { .. } +# -- +trait ${1:name} extends ${2:class} with ${3:trait} { + $0 +} \ 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 @@ +#Author : Anders Bach Nielsen +#name : trait T1 with T2 { .. } +# -- +trait ${1:name} with ${2:trait} { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : try { .. } catch { case e => ..} +# -- +try { + $0 +} catch { + case ${1:e}: ${2:Exception} => + ${1:println(\"ERROR: \" + e) // TODO: handle exception}\n} +} \ 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 @@ +#Author : Jonas Bonèr +#name : try { .. } catch { case e => ..} finally { ..} +# -- +try { + $0 +} catch { + case ${1:e}: ${2:Exception} => + ${1:println(\"ERROR: \" + e) // TODO: handle exception}\n} +} finally { + +} \ 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 @@ +#Author : Jonas Bonèr +#name : try { .. } finally { .. } +# -- +try { + +} finally { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : element1 -> element2 +# -- +${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 @@ +#Author : Jonas Bonèr +#name : (element1, element2) +# -- +(${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 @@ +#Author : Jonas Bonèr +#name : val name = .. +# -- +val ${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 @@ +#Author : Jonas Bonèr +#name : val name = new .. +# -- +val ${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 @@ +#Author : Jonas Bonèr +#name : val name: T = .. +# -- +val ${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 @@ +#Author : Jonas Bonèr +#name : var name = .. +# -- +var ${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 @@ +#Author : Jonas Bonèr +#name : var name = new .. +# -- +var ${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 @@ +#Author : Jonas Bonèr +#name : var name: T = .. +# -- +var ${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 @@ +#Author : Jonas Bonèr +#name : while(cond) { .. } +# -- +while (${1:condition}) { + $0 +} \ 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 @@ +#Author : Jonas Bonèr +#name : with T +# -- +with $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 @@ +# name : ${ ... } field +# contributor : joaotavora +# key : $f +# -- +\${${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 @@ +# name : ${n:$(...)} mirror +# key : $m +# contributor : joaotavora +# -- +\${${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 @@ +# name : Snippet header +# contributor : joaotavora +# -- +# name : $1${2: +# key : ${3:expand-key}}${4: +# group : ${5:group}} +# contributor : $6 +# -- +$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 @@ +#contributor : Alejandro Espinoza Esparza +#name : , ColumnName ColumnType NOT NULL... +# -- + , ${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 @@ +#contributor : Alejandro Espinoza Esparza +#name : CONSTRAINT [..] PRIMARY KEY ... +# -- +CONSTRAINT [${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 @@ +#contributor : Alejandro Espinoza Esparza +#name : CONSTRAINT [..] FOREIGN KEY ... +# -- +CONSTRAINT [${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 @@ +#contributor : Alejandro Espinoza Esparza +#name : create table ... +# -- +CREATE TABLE [${1:dbo}].[${2:TableName}] +( + ${3:Id} ${4:INT IDENTITY(1,1)} ${5:NOT NULL} +$0 + CONSTRAINT [${6:PK_}] PRIMARY KEY ${7:CLUSTERED} ([$3]) +) +GO 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : create procedure ... +# -- +CREATE PROCEDURE [${1:dbo}].[${2:Name}] +( + $3 $4 = ${5:NULL} ${6:OUTPUT} +) +AS +BEGIN +$0 +END +GO 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 @@ +#contributor : Alejandro Espinoza Esparza +#name : REFERENCES ... +# -- +REFERENCES ${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 @@ +#name : (current time) +# -- +`(current-time-string)` \ No newline at end of file -- cgit v1.3