File: commentblock

package info (click to toggle)
yasnippet-snippets 0~git20161123-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,000 kB
  • ctags: 19
  • sloc: lisp: 73; python: 23; ada: 4; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 2,000 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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