diff options
| author | Simeon Simeonov | 2016-09-06 07:39:30 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2016-09-06 07:39:30 +0200 |
| commit | 6a3efe35bf8b20b0900dbbf7747b8b8d0d19bd04 (patch) | |
| tree | 1d00039f67672be9e0f8abb48aaad663ab85a37b /.emacs.d/snippets/prog-mode/commentblock | |
| parent | 991f8ff925f51fd5598db72885f8cca1a1a79bed (diff) | |
Upgrade ports
Diffstat (limited to '.emacs.d/snippets/prog-mode/commentblock')
| -rw-r--r-- | .emacs.d/snippets/prog-mode/commentblock | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/.emacs.d/snippets/prog-mode/commentblock b/.emacs.d/snippets/prog-mode/commentblock new file mode 100644 index 0000000..ba61f61 --- /dev/null +++ b/.emacs.d/snippets/prog-mode/commentblock | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # contributor: sh-ow <sh-ow@users.noreply.github.com> | ||
| 3 | # name: commentblock | ||
| 4 | # key: cob | ||
| 5 | # -- | ||
| 6 | ${1:$(let* ((col (current-column)) | ||
| 7 | (str "") | ||
| 8 | (lastcom (substring (yas-trimmed-comment-start) -1)) | ||
| 9 | (start (yas-trimmed-comment-start)) | ||
| 10 | (end (yas-trimmed-comment-end)) | ||
| 11 | (over (- (+ (string-width yas-text) (length start) (length end) col) 77))) | ||
| 12 | (while (< (length str) (+ (- 79 (length start) (length end) col) (if (> over 0) over 0))) | ||
| 13 | (setq str (concat str lastcom))) | ||
| 14 | (concat start str end))} | ||
| 15 | ${1:$(let* ((col (current-column)) | ||
| 16 | (str "") | ||
| 17 | (start (yas-trimmed-comment-start)) | ||
| 18 | (end (yas-trimmed-comment-end))) | ||
| 19 | (while (< (length str) (ffloor (/ (- 78.0 (+ col (length start) (string-width yas-text) (length end))) 2.0))) | ||
| 20 | (setq str (concat str " "))) | ||
| 21 | (concat start str))} ${1:comment} ${1:$(let* ((col (current-column)) | ||
| 22 | (str "") | ||
| 23 | (start (yas-trimmed-comment-start)) | ||
| 24 | (end (yas-trimmed-comment-end))) | ||
| 25 | (while (< (length str) (- 79.0 (if (eq (mod (string-width yas-text) 2) 1) (- col 1) col) (length end))) | ||
| 26 | (setq str (concat str " "))) | ||
| 27 | (concat str end))} | ||
| 28 | ${1:$(let* ((col (current-column)) | ||
| 29 | (str "") | ||
| 30 | (lastcom (substring (yas-trimmed-comment-start) -1)) | ||
| 31 | (start (yas-trimmed-comment-start)) | ||
| 32 | (end (yas-trimmed-comment-end)) | ||
| 33 | (over (- (+ (string-width yas-text) (length start) (length end) col) 77))) | ||
| 34 | (while (< (length str) (+ (- 79 (length start) (length end) col) (if (> over 0) over 0))) | ||
| 35 | (setq str (concat str lastcom))) | ||
| 36 | (concat start str end))}$0 \ No newline at end of file | ||
