summaryrefslogtreecommitdiffstats
path: root/emacs/snippets
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/snippets')
-rw-r--r--emacs/snippets/Makefile4
-rw-r--r--emacs/snippets/html-mode/Makefile4
-rw-r--r--emacs/snippets/html-mode/for8
-rw-r--r--emacs/snippets/html-mode/generic-block8
-rw-r--r--emacs/snippets/org-mode/Makefile4
-rw-r--r--emacs/snippets/org-mode/codeblock7
-rw-r--r--emacs/snippets/org-mode/heading9
-rw-r--r--emacs/snippets/org-mode/project51
-rw-r--r--emacs/snippets/org-mode/snippet14
-rw-r--r--emacs/snippets/python-mode/Makefile4
-rw-r--r--emacs/snippets/python-mode/defm_empty7
-rw-r--r--emacs/snippets/python-mode/form9
-rw-r--r--emacs/snippets/python-mode/form_valid8
-rw-r--r--emacs/snippets/python-mode/import_from6
-rw-r--r--emacs/snippets/python-mode/permission_guard9
-rw-r--r--emacs/snippets/python-mode/url5
16 files changed, 157 insertions, 0 deletions
diff --git a/emacs/snippets/Makefile b/emacs/snippets/Makefile
new file mode 100644
index 0000000..12ff544
--- /dev/null
+++ b/emacs/snippets/Makefile
@@ -0,0 +1,4 @@
+DESTDIR:=$(DESTDIR)/snippets
+modules=html-mode org-mode python-mode
+
+include ../../dotfiles.mk
diff --git a/emacs/snippets/html-mode/Makefile b/emacs/snippets/html-mode/Makefile
new file mode 100644
index 0000000..b2dff78
--- /dev/null
+++ b/emacs/snippets/html-mode/Makefile
@@ -0,0 +1,4 @@
+DESTDIR:=$(DESTDIR)/html-mode
+objects=for generic-block
+
+include ../../../dotfiles.mk
diff --git a/emacs/snippets/html-mode/for b/emacs/snippets/html-mode/for
new file mode 100644
index 0000000..01d9c44
--- /dev/null
+++ b/emacs/snippets/html-mode/for
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: for
+# key: for
+# condition: pony-tpl-minor-mode
+# --
+{% for $1 in $2 %}
+ $0
+{% endfor %} \ No newline at end of file
diff --git a/emacs/snippets/html-mode/generic-block b/emacs/snippets/html-mode/generic-block
new file mode 100644
index 0000000..82d40c7
--- /dev/null
+++ b/emacs/snippets/html-mode/generic-block
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: Template Block
+# key: %
+# condition: pony-tpl-minor-mode
+# --
+{% $1 %}
+ $0
+{% end$1 %} \ No newline at end of file
diff --git a/emacs/snippets/org-mode/Makefile b/emacs/snippets/org-mode/Makefile
new file mode 100644
index 0000000..34d4cd9
--- /dev/null
+++ b/emacs/snippets/org-mode/Makefile
@@ -0,0 +1,4 @@
+DESTDIR:=$(DESTDIR)/org-mode
+objects=codeblock heading project snippet
+
+include ../../../dotfiles.mk
diff --git a/emacs/snippets/org-mode/codeblock b/emacs/snippets/org-mode/codeblock
new file mode 100644
index 0000000..a200b08
--- /dev/null
+++ b/emacs/snippets/org-mode/codeblock
@@ -0,0 +1,7 @@
+# -*- mode: snippet -*-
+# name: codeblock
+# key: code
+# --
+#+begin_src $1
+ $0
+#+end_src \ No newline at end of file
diff --git a/emacs/snippets/org-mode/heading b/emacs/snippets/org-mode/heading
new file mode 100644
index 0000000..9d5451e
--- /dev/null
+++ b/emacs/snippets/org-mode/heading
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: Heading
+# key: *
+# --
+${1:*} ${2:TODO} $3
+${1:$(make-string (length text) ?\ )} :PROPERTIES:
+${1:$(make-string (length text) ?\ )} :CATEGORY: $4
+${1:$(make-string (length text) ?\ )} :END:
+${1:$(make-string (length text) ?\ )} $0 \ No newline at end of file
diff --git a/emacs/snippets/org-mode/project b/emacs/snippets/org-mode/project
new file mode 100644
index 0000000..269d655
--- /dev/null
+++ b/emacs/snippets/org-mode/project
@@ -0,0 +1,51 @@
+# -*- mode: snippet -*-
+# name: project
+# key: project
+# --
+#+TITLE: ${1:project_name}
+#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/}
+#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz
+#+LINK: zip $2$4.zip
+#+STARTUP: showall
+
+#+begin_html
+ <script src="/keyjs.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ keyjs_initialize({ "u": [ "keyjs_goto", "../index.html" ],
+ "h": [ "keyjs_goto", "http://ryuslash.org" ] });
+ </script>
+#+end_html
+
+#+INCLUDE: "dlmenu.inc"
+
+* About
+
+ ${5:A short description about $1}
+
+ | $0Status | $6 |
+ | Language | $7 |
+ | License | ${8:GPLv3} |
+
+* Why?
+
+ ${9:Why did you even think of writing $1?}
+
+* Features
+
+ ${10:$1 does...}
+
+* Dependencies
+
+ ${11:$1 needs to have...}
+
+* Download
+
+ ${12:To download $1...}
+
+* Install
+
+ ${13:To install $1...}
+
+* Usage
+
+ ${14:Using $1...} \ No newline at end of file
diff --git a/emacs/snippets/org-mode/snippet b/emacs/snippets/org-mode/snippet
new file mode 100644
index 0000000..67f15d5
--- /dev/null
+++ b/emacs/snippets/org-mode/snippet
@@ -0,0 +1,14 @@
+# -*- mode: snippet -*-
+# name: snippet
+# key: snippet
+# --
+#+TITLE: ${1:snippet-name}
+#+OPTIONS: toc:nil
+
+* $1
+
+ ${2:A short description abount $1}
+
+ #+BEGIN_SRC $3 :tangle yes
+$0
+ #+END_SRC \ No newline at end of file
diff --git a/emacs/snippets/python-mode/Makefile b/emacs/snippets/python-mode/Makefile
new file mode 100644
index 0000000..192657b
--- /dev/null
+++ b/emacs/snippets/python-mode/Makefile
@@ -0,0 +1,4 @@
+DESTDIR:=$(DESTDIR)/python-mode
+objects=defm_empty form form_valid import_from permission_guard url
+
+include ../../../dotfiles.mk
diff --git a/emacs/snippets/python-mode/defm_empty b/emacs/snippets/python-mode/defm_empty
new file mode 100644
index 0000000..baa976e
--- /dev/null
+++ b/emacs/snippets/python-mode/defm_empty
@@ -0,0 +1,7 @@
+# -*- coding: utf-8 -*-
+# name: Empty Defmethod
+# key: defm
+# --
+def ${1:name}(self, *args, **kwargs):
+ '''$2'''
+ return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).$1(*args, **kwargs) \ No newline at end of file
diff --git a/emacs/snippets/python-mode/form b/emacs/snippets/python-mode/form
new file mode 100644
index 0000000..225d5e4
--- /dev/null
+++ b/emacs/snippets/python-mode/form
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: Model Form
+# key: form
+# --
+class ${1:Model}Form(forms.ModelForm):
+ '''Form for the $1 model.'''
+
+ class Meta:
+ model = $1 \ No newline at end of file
diff --git a/emacs/snippets/python-mode/form_valid b/emacs/snippets/python-mode/form_valid
new file mode 100644
index 0000000..c5a7e58
--- /dev/null
+++ b/emacs/snippets/python-mode/form_valid
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: Record form
+# key: defm
+# --
+@record_activity(model=${1:`(progn (re-search-backward "^[ \t]*model = \\([a-zA-Z_].*\\)$") (match-string 1))`})
+def form_valid(self, form):
+ '''Make sure any changes to the $1 model get logged.'''
+ return super(${2:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).form_valid(form) \ No newline at end of file
diff --git a/emacs/snippets/python-mode/import_from b/emacs/snippets/python-mode/import_from
new file mode 100644
index 0000000..5c23b8e
--- /dev/null
+++ b/emacs/snippets/python-mode/import_from
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# name: from ... import ...
+# contributor: Tom Willemsen
+# key: from
+# --
+from ${1:module} import ${2:class_or_module} \ No newline at end of file
diff --git a/emacs/snippets/python-mode/permission_guard b/emacs/snippets/python-mode/permission_guard
new file mode 100644
index 0000000..ab53895
--- /dev/null
+++ b/emacs/snippets/python-mode/permission_guard
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: Permission guard
+# key: defm
+# --
+@method_decorator(permission_required('$1',
+ raise_exception=True))
+def dispatch(self, *args, **kwargs):
+ '''Make sure the user has the $1 permission.'''
+ return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).dispatch(*args, **kwargs) \ No newline at end of file
diff --git a/emacs/snippets/python-mode/url b/emacs/snippets/python-mode/url
new file mode 100644
index 0000000..00ade72
--- /dev/null
+++ b/emacs/snippets/python-mode/url
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: url
+# key: url
+# --
+url(r'^$1', $2, name='$3'), \ No newline at end of file