Skip to content

Commit 9205da0

Browse files
authored
prog-mode: Add snippets for SPDX-* comments (#512)
1 parent 03fd78b commit 9205da0

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

snippets/prog-mode/.yas-setup.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
"This function returns `comment-start' trimmed by whitespaces."
3030
(yas-s-trim comment-start))
3131

32+
(defun yas-trimmed-add-comment ()
33+
"This function returns `comment-start' trimmed by whitespaces. It uses
34+
`comment-add' to determine how many comment symbols to insert."
35+
(yas-s-trim (apply #'concat (mapcar (lambda (x)
36+
comment-start)
37+
(number-sequence 0 comment-add)))))
38+
3239
(defun yas-trimmed-comment-end ()
3340
"This function returns `comment-end' trimmed by whitespaces if
3441
`comment-end' is not empty. Otherwise the reversed output of

snippets/prog-mode/spdxcopyright

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Antero Mejr <mail@antr.me>
3+
# name: spdxcopyright
4+
# key: spc
5+
# --
6+
`(yas-trimmed-add-comment)` SPDX-FileCopyrightText: $0`comment-end`

snippets/prog-mode/spdxlicense

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Antero Mejr <mail@antr.me>
3+
# name: spdxlicense
4+
# key: spl
5+
# --
6+
`(yas-trimmed-add-comment)` SPDX-License-Identifier: $0`comment-end`

0 commit comments

Comments
 (0)