diff options
author | sh-ow <sh-ow@users.noreply.github.com> | 2016-04-13 23:56:17 +0200 |
---|---|---|
committer | sh-ow <sh-ow@users.noreply.github.com> | 2016-04-13 23:56:17 +0200 |
commit | f60ba1e8066444a513eb95187cdd75a28745c940 (patch) | |
tree | 979b1b4a7b3964d9be4548c7942cbe69fbf15f47 | |
parent | 29e0a872dec37cff3c3e8325056e5fc7020e4562 (diff) |
prog-mode: fix in .yas-setup.el, add comment snippet, change keys
-rw-r--r-- | prog-mode/.yas-setup.el | 2 | ||||
-rw-r--r-- | prog-mode/comment | 6 | ||||
-rw-r--r-- | prog-mode/commentblock | 5 | ||||
-rw-r--r-- | prog-mode/commentline | 8 |
4 files changed, 12 insertions, 9 deletions
diff --git a/prog-mode/.yas-setup.el b/prog-mode/.yas-setup.el index c006d05..b5c78e3 100644 --- a/prog-mode/.yas-setup.el +++ b/prog-mode/.yas-setup.el @@ -10,7 +10,7 @@ (defun yas-get-comment-end () (if (eq (length comment-end) 0) - (reverse start) + (reverse (yas-get-comment-start)) (substring comment-end (dotimes (i (length comment-end)) (unless (or (eq (aref comment-end i) nil) diff --git a/prog-mode/comment b/prog-mode/comment new file mode 100644 index 0000000..3a0f6c5 --- /dev/null +++ b/prog-mode/comment @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# contributor: sh-ow <sh-ow@users.noreply.github.com> +# name: comment +# key: co +# -- +${1:$(yas-get-comment-start)} ${1:comment}${1:$(unless (eq (length comment-end) 0) (concat " " (yas-get-comment-end)))}$0
\ No newline at end of file diff --git a/prog-mode/commentblock b/prog-mode/commentblock index 57eb46b..09bcddb 100644 --- a/prog-mode/commentblock +++ b/prog-mode/commentblock @@ -1,7 +1,7 @@ # -*- mode: snippet -*- # contributor: sh-ow <sh-ow@users.noreply.github.com> # name: commentblock -# key: com +# key: cob # -- ${1:$(let* ((col (current-column)) (str "") @@ -33,5 +33,4 @@ ${1:$(let* ((col (current-column)) (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 + (concat start str end))}$0
\ No newline at end of file diff --git a/prog-mode/commentline b/prog-mode/commentline index c794f7c..e8a5a8c 100644 --- a/prog-mode/commentline +++ b/prog-mode/commentline @@ -1,15 +1,13 @@ # -*- mode: snippet -*- # contributor: sh-ow <sh-ow@users.noreply.github.com> # name: commentline -# key: co +# key: col # -- -${1:$(let* ((start (yas-get-comment-start))) - start)} ${1:comment} ${1:$(let* ((str "") +${1:$(yas-get-comment-start)} ${1:comment} ${1:$(let* ((str "") (curr (current-column)) (start (yas-get-comment-start)) (lastcom (substring start -1)) (end (yas-get-comment-end))) (while (< (length str) (- 79 (+ curr (length end)))) (setq str (concat str lastcom))) - (concat str end))} -$0 + (concat str end))}$0
\ No newline at end of file |