summaryrefslogtreecommitdiff
path: root/prog-mode/commentblock
diff options
context:
space:
mode:
authorAlberto Luaces <aluaces@udc.es>2016-12-01 14:02:56 +0100
committerAlberto Luaces <aluaces@udc.es>2016-12-01 14:02:56 +0100
commit83355faf3e530fb36fcb32750ebedda19e1927ef (patch)
treeff9f7eb3cfb4842c41173e67b3a6614332343b24 /prog-mode/commentblock
parent632df2ede2712994b12ee499abfc948e6dc3f9ae (diff)
parent12b385f3badb51bd3689a1a0986cc9410ea416c5 (diff)
Merge latest upstream.
Diffstat (limited to 'prog-mode/commentblock')
-rw-r--r--prog-mode/commentblock36
1 files changed, 36 insertions, 0 deletions
diff --git a/prog-mode/commentblock b/prog-mode/commentblock
new file mode 100644
index 0000000..ba61f61
--- /dev/null
+++ b/prog-mode/commentblock
@@ -0,0 +1,36 @@
+# -*- mode: snippet -*-
+# contributor: sh-ow <sh-ow@users.noreply.github.com>
+# name: commentblock
+# key: cob
+# --
+${1:$(let* ((col (current-column))
+ (str "")
+ (lastcom (substring (yas-trimmed-comment-start) -1))
+ (start (yas-trimmed-comment-start))
+ (end (yas-trimmed-comment-end))
+ (over (- (+ (string-width yas-text) (length start) (length end) col) 77)))
+ (while (< (length str) (+ (- 79 (length start) (length end) col) (if (> over 0) over 0)))
+ (setq str (concat str lastcom)))
+ (concat start str end))}
+${1:$(let* ((col (current-column))
+ (str "")
+ (start (yas-trimmed-comment-start))
+ (end (yas-trimmed-comment-end)))
+ (while (< (length str) (ffloor (/ (- 78.0 (+ col (length start) (string-width yas-text) (length end))) 2.0)))
+ (setq str (concat str " ")))
+ (concat start str))} ${1:comment} ${1:$(let* ((col (current-column))
+ (str "")
+ (start (yas-trimmed-comment-start))
+ (end (yas-trimmed-comment-end)))
+ (while (< (length str) (- 79.0 (if (eq (mod (string-width yas-text) 2) 1) (- col 1) col) (length end)))
+ (setq str (concat str " ")))
+ (concat str end))}
+${1:$(let* ((col (current-column))
+ (str "")
+ (lastcom (substring (yas-trimmed-comment-start) -1))
+ (start (yas-trimmed-comment-start))
+ (end (yas-trimmed-comment-end))
+ (over (- (+ (string-width yas-text) (length start) (length end) col) 77)))
+ (while (< (length str) (+ (- 79 (length start) (length end) col) (if (> over 0) over 0)))
+ (setq str (concat str lastcom)))
+ (concat start str end))}$0 \ No newline at end of file