summaryrefslogtreecommitdiff
path: root/etc/srecode/template.srt
blob: a651e324d3a9362a078debec4d8877c2c66d8ebf (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
;;; template.srt --- Templates for Semantic Recoders

;; Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.

;; Author: Eric Ludlam <zappo@gnu.org>

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

set escape_start "$"
set escape_end "$"
set mode "srecode-template-mode"
set priority "70"

set comment_start  ";;"
set comment_end    ""
set comment_prefix ";;"

set SEPARATOR "----"

set DOLLAR "$"

context file

prompt MAJORMODE "Major Mode for templates: " read srecode-read-major-mode-name
prompt START "Escape Start Characters: " default "{{"
prompt END "Escape End Characters: " default "}}"

template empty :file :user :time :srt
"Insert a skeleton for a template file."
----
$>:filecomment$

set mode "$?MAJORMODE$"
set escape_start "$?START$"
set escape_end "$?END$"

context file

$^$


;; end
----

template mode-basics :srt
"Fill out a full template including parts for basic new mode stuff."
sectiondictionary "E"
set NAME "empty :file :user :time"
set DOC "Fill out an empty file."
set KEY "e"
sectiondictionary "C1"
set NAME "declaration"
sectiondictionary "DTF"
set NAME "function :blank :indent"
set DOC "Template to declare a function."
set KEY "f"
sectiondictionary "DTV"
set NAME "variable :blank :indent"
set DOC "Template to declare a variable."
set KEY "v"
sectiondictionary "PR"
set NAME "NAME"
set PROMPT "Name for declaration: "
----
$>:declaration:commentchars$

$<E:declaration:function$
$ESCAPE_START$>:filecomment$ESCAPE_END$
$/E$

$>C1:declaration:context$

$>PR:declaration:prompt$

$>DTF:declaration:function$
$>DTV:declaration:function$
----
bind "m"


context declaration

prompt NAME "Name of new template: "
prompt KEY "Key Binding: " read read-char

template function :blank
"Insert a template block for Srecoder templates."
----
template $?NAME$$#ARG$$NAME$$/ARG$
"$DOC$"
$SEPARATOR$
$^$
$SEPARATOR$
bind "$?KEY$"
----
bind "f"

prompt NAME "Name of new variable: "

template variable :blank
"Inert a variable."
----
set $?NAME$ "$^$"
----
bind "v"

template prompt :blank
"Insert a prompt."
----
prompt $?NAME$ "$?PROMPT$"
----
bind "p"

template priority :blank
"Insert a priority statement."
----
set priority $^$
----

template application :blank
"Insert an application statement."
----
set application "$^$"
----

template context :blank
"Insert a context statement."
----
context $NAME$
----
bind "c"

template commentchars :blank
"Insert the variables for handling comments."
----
set comment_start  ""
set comment_end    ""
set comment_prefix ""
----

context code

prompt NAME "Name of variable: " read srecode-read-variable-name

template variable :srt
"Insert a variable with completion from the current file."
----
$ESCAPE_START$$?NAME$$ESCAPE_END$
----
bind "v"

prompt NAME "Name of macro: "

template ask :srt
"Insert a prompting variable."
----
$ESCAPE_START$?$?NAME$$ESCAPE_END$
----
bind "a"

template comment :srt
----
$ESCAPE_START$!$^$$ESCAPE_END$
----
bind "c"

prompt TEMPLATE "Template to include: " read srecode-read-template-name

template include :srt
----
$ESCAPE_START$>:$?TEMPLATE$$ESCAPE_END$
----
bind "i"

template includewrap :srt
----
$ESCAPE_START$<:$?TEMPLATE$$ESCAPE_END$$^$$ESCAPE_START$/$NAME$$ESCAPE_END$
----
bind "w"

template point :srt
----
$ESCAPE_START$^$ESCAPE_END$
----
bind "p"

template section :srt
"Insert a section, or looping construct."
----
$ESCAPE_START$#$?NAME$$ESCAPE_END$
$^$
$ESCAPE_START$/$NAME$$ESCAPE_END$
----
bind "s"

template escape-start-quoted :srt
"Escape Start"
----
$ESCAPE_START$ESCAPE_START$ESCAPE_END$
----
bind "q"

template escape-end-quoted :srt
"Escape Start"
----
$ESCAPE_START$ESCAPE_END$ESCAPE_END$
----
bind "e"


;; end