aboutsummaryrefslogtreecommitdiff
path: root/etc/snippets/tempel/scheme-mode
blob: ef73a1e595a241b27c42741d41a32d46a4563f79 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
-*- mode: lisp-data -*-

scheme-mode

(package...
 "(define-public " (s name)
 n> "(package"
 n  > "(name \"" (s name) "\")"
 n  > "(version \"" p "\")"
 n  > "(source origin...)"
 n  > "(build-system " (p "gnu") "-build-system)"
 n  > "(home-page \"" p "\")"
 n  > "(synopsis \"" p "\")"
 n  > "(description \"" p "\")"
 n  > "(license license:" (p "unknown") ")))" n)

(origin...
 "(origin"
 n> "(method " (p "url-fetch" method) ")"
 n> "(uri " (cl-case (and method (intern method))
              ('git-fetch "git-reference...")
              ('svn-fetch "svn-reference...")
              ('hg-fetch  "hg-reference...")
              ('cvs-fetch "cvs-reference...")
              ('bzr-fetch "bzr-reference...")
              (t          "\"https://...\""))
 ")"
 n>
 (cl-case (and method (intern method))
   ('git-fetch
    (insert "(file-name (git-file-name name version))")
    (newline)
    (indent-according-to-mode))
   ('hg-fetch
    (insert "(file-name (hg-file-name name version))")
    (newline)
    (indent-according-to-mode))
   ('svn-fetch
    (insert "(file-name (string-append name \"-\" version \"-checkout\"))")
    (newline)
    (indent-according-to-mode))
   ('cvs-fetch
    (insert "(file-name (string-append name \"-\" version \"-checkout\"))")
    (newline)
    (indent-according-to-mode))
   ('bzr-fetch
    (insert "(file-name (string-append name \"-\" version \"-checkout\"))")
    (newline)
    (indent-according-to-mode))
   (t          ""))
 > "(sha256"
 n > "(base32 \""
 ;; hash of an empty directory
 (p "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5") "\")))")

(git-reference...
 "(git-reference"
 n> "(url \"" p "\")"
 n> "(commit " (p "commit") "))")

(svn-reference...
 "(svn-reference"
 n> "(url \"" p "\")"
 n> "(revision " (p "revision") "))")

(cvs-reference...
 "(cvs-reference"
 n> "(root-directory \"" p "\")"
 n> "(module \"" p "\")"
 n> "(revision \"" p "\"))")

(hg-reference...
 "(hg-reference"
 n> "(url \"" p "\")"
 n> "(changeset " (p "changeset") "))")

(bzr-reference...
 "(bzr-reference"
 n> "(url \"" p "\")"
 n> "(revision " (p "revision") "))")

(:phases\ "#:phases (modify-phases %standard-phases"
          n> p ")")

(add-before\ "(add-before '" p " '" p
             n > p ")")
(add-after\ "(add-after '" p " '" p
            n > p ")")
(replace\ "(replace '" p " " p")")