diff options
| author | Simeon Simeonov | 2013-09-19 22:27:58 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2013-09-19 22:27:58 +0200 |
| commit | 7bf6712498ad2618bee7bf5b3866fb6da0772339 (patch) | |
| tree | fd4d959c0f1679f2abf5663399d68df0a06472de /.emacs.d/mysnippets/text-mode/python-mode/class | |
| parent | b045e27c545d4027811637193632ec3ea5ef7858 (diff) | |
All snippets imported, init file polished
Diffstat (limited to '.emacs.d/mysnippets/text-mode/python-mode/class')
| -rw-r--r-- | .emacs.d/mysnippets/text-mode/python-mode/class | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/class b/.emacs.d/mysnippets/text-mode/python-mode/class new file mode 100644 index 0000000..72f339b --- /dev/null +++ b/.emacs.d/mysnippets/text-mode/python-mode/class | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | # name: class | ||
| 3 | # contributor: Orestis Markou | ||
| 4 | # contributor: Nishio Hirokazu | ||
| 5 | # contributor: Yasser González Fernández <yglez@uh.cu> | ||
| 6 | # -- | ||
| 7 | class ${1:ClassName}(${2:object}): | ||
| 8 | """$3 | ||
| 9 | """ | ||
| 10 | |||
| 11 | def __init__(self, $4): | ||
| 12 | """$5 | ||
| 13 | ${4:$ | ||
| 14 | (let* ((indent | ||
| 15 | (concat "\n" (make-string (current-column) 32))) | ||
| 16 | (args | ||
| 17 | (mapconcat | ||
| 18 | '(lambda (x) | ||
| 19 | (if (not (string= (nth 0 x) "")) | ||
| 20 | (concat "- " (char-to-string 96) (nth 0 x) | ||
| 21 | (char-to-string 96) ":"))) | ||
| 22 | (mapcar | ||
| 23 | '(lambda (x) | ||
| 24 | (mapcar | ||
| 25 | (lambda (x) | ||
| 26 | (replace-regexp-in-string "[[:blank:]]*$" "" | ||
| 27 | (replace-regexp-in-string "^[[:blank:]]*" "" x))) x)) | ||
| 28 | (mapcar '(lambda (x) (split-string x "=")) | ||
| 29 | (split-string text ","))) | ||
| 30 | indent))) | ||
| 31 | (if (string= args "") | ||
| 32 | (make-string 3 34) | ||
| 33 | (mapconcat | ||
| 34 | 'identity | ||
| 35 | (list "" "Arguments:" args (make-string 3 34)) | ||
| 36 | indent))) | ||
| 37 | } | ||
| 38 | ${4:$ | ||
| 39 | (mapconcat | ||
| 40 | '(lambda (x) | ||
| 41 | (if (not (string= (nth 0 x) "")) | ||
| 42 | (concat "self._" (nth 0 x) " = " (nth 0 x)))) | ||
| 43 | (mapcar | ||
| 44 | '(lambda (x) | ||
| 45 | (mapcar | ||
| 46 | '(lambda (x) | ||
| 47 | (replace-regexp-in-string "[[:blank:]]*$" "" | ||
| 48 | (replace-regexp-in-string "^[[:blank:]]*" "" x))) | ||
| 49 | x)) | ||
| 50 | (mapcar '(lambda (x) (split-string x "=")) | ||
| 51 | (split-string text ","))) | ||
| 52 | (concat "\n" (make-string (current-column) 32))) | ||
| 53 | } | ||
| 54 | $0 | ||
