Commit | Line | Data |
---|---|---|
c05676c5 CY |
1 | ;;; template.srt --- Templates for Semantic Recoders |
2 | ||
ba318903 | 3 | ;; Copyright (C) 2005, 2007-2014 Free Software Foundation, Inc. |
c05676c5 CY |
4 | |
5 | ;; Author: Eric Ludlam <zappo@gnu.org> | |
6 | ||
7 | ;; This file is part of GNU Emacs. | |
8 | ||
9 | ;; GNU Emacs is free software: you can redistribute it and/or modify | |
10 | ;; it under the terms of the GNU General Public License as published by | |
11 | ;; the Free Software Foundation, either version 3 of the License, or | |
12 | ;; (at your option) any later version. | |
13 | ||
14 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;; GNU General Public License for more details. | |
18 | ||
19 | ;; You should have received a copy of the GNU General Public License | |
20 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
21 | ||
22 | set escape_start "$" | |
23 | set escape_end "$" | |
24 | set mode "srecode-template-mode" | |
25 | set priority "70" | |
26 | ||
27 | set comment_start ";;" | |
28 | set comment_end "" | |
29 | set comment_prefix ";;" | |
30 | ||
31 | set SEPARATOR "----" | |
32 | ||
33 | set DOLLAR "$" | |
34 | ||
35 | context file | |
36 | ||
37 | prompt MAJORMODE "Major Mode for templates: " read srecode-read-major-mode-name | |
38 | prompt START "Escape Start Characters: " default "{{" | |
39 | prompt END "Escape End Characters: " default "}}" | |
40 | ||
41 | template empty :file :user :time :srt | |
42 | "Insert a skeleton for a template file." | |
43 | ---- | |
44 | $>:filecomment$ | |
45 | ||
46 | set mode "$?MAJORMODE$" | |
47 | set escape_start "$?START$" | |
48 | set escape_end "$?END$" | |
49 | ||
50 | context file | |
51 | ||
52 | $^$ | |
53 | ||
54 | ||
55 | ;; end | |
56 | ---- | |
57 | ||
58 | template mode-basics :srt | |
59 | "Fill out a full template including parts for basic new mode stuff." | |
60 | sectiondictionary "E" | |
61 | set NAME "empty :file :user :time" | |
62 | set DOC "Fill out an empty file." | |
63 | set KEY "e" | |
64 | sectiondictionary "C1" | |
65 | set NAME "declaration" | |
66 | sectiondictionary "DTF" | |
67 | set NAME "function :blank :indent" | |
68 | set DOC "Template to declare a function." | |
69 | set KEY "f" | |
70 | sectiondictionary "DTV" | |
71 | set NAME "variable :blank :indent" | |
72 | set DOC "Template to declare a variable." | |
73 | set KEY "v" | |
74 | sectiondictionary "PR" | |
75 | set NAME "NAME" | |
76 | set PROMPT "Name for declaration: " | |
77 | ---- | |
78 | $>:declaration:commentchars$ | |
79 | ||
80 | $<E:declaration:function$ | |
81 | $ESCAPE_START$>:filecomment$ESCAPE_END$ | |
82 | $/E$ | |
83 | ||
84 | $>C1:declaration:context$ | |
85 | ||
86 | $>PR:declaration:prompt$ | |
87 | ||
88 | $>DTF:declaration:function$ | |
89 | $>DTV:declaration:function$ | |
90 | ---- | |
91 | bind "m" | |
92 | ||
93 | ||
94 | context declaration | |
95 | ||
96 | prompt NAME "Name of new template: " | |
97 | prompt KEY "Key Binding: " read read-char | |
98 | ||
99 | template function :blank | |
100 | "Insert a template block for Srecoder templates." | |
101 | ---- | |
102 | template $?NAME$$#ARG$$NAME$$/ARG$ | |
103 | "$DOC$" | |
104 | $SEPARATOR$ | |
105 | $^$ | |
106 | $SEPARATOR$ | |
107 | bind "$?KEY$" | |
108 | ---- | |
109 | bind "f" | |
110 | ||
111 | prompt NAME "Name of new variable: " | |
112 | ||
113 | template variable :blank | |
114 | "Inert a variable." | |
115 | ---- | |
116 | set $?NAME$ "$^$" | |
117 | ---- | |
118 | bind "v" | |
119 | ||
120 | template prompt :blank | |
121 | "Insert a prompt." | |
122 | ---- | |
123 | prompt $?NAME$ "$?PROMPT$" | |
124 | ---- | |
125 | bind "p" | |
126 | ||
127 | template priority :blank | |
c80e3b4a | 128 | "Insert a priority statement." |
c05676c5 CY |
129 | ---- |
130 | set priority $^$ | |
131 | ---- | |
132 | ||
133 | template application :blank | |
c80e3b4a | 134 | "Insert an application statement." |
c05676c5 CY |
135 | ---- |
136 | set application "$^$" | |
137 | ---- | |
138 | ||
139 | template context :blank | |
140 | "Insert a context statement." | |
141 | ---- | |
142 | context $NAME$ | |
143 | ---- | |
144 | bind "c" | |
145 | ||
146 | template commentchars :blank | |
147 | "Insert the variables for handling comments." | |
148 | ---- | |
149 | set comment_start "" | |
150 | set comment_end "" | |
151 | set comment_prefix "" | |
152 | ---- | |
153 | ||
154 | context code | |
155 | ||
156 | prompt NAME "Name of variable: " read srecode-read-variable-name | |
157 | ||
158 | template variable :srt | |
159 | "Insert a variable with completion from the current file." | |
160 | ---- | |
161 | $ESCAPE_START$$?NAME$$ESCAPE_END$ | |
162 | ---- | |
163 | bind "v" | |
164 | ||
165 | prompt NAME "Name of macro: " | |
166 | ||
167 | template ask :srt | |
168 | "Insert a prompting variable." | |
169 | ---- | |
170 | $ESCAPE_START$?$?NAME$$ESCAPE_END$ | |
171 | ---- | |
172 | bind "a" | |
173 | ||
174 | template comment :srt | |
175 | ---- | |
176 | $ESCAPE_START$!$^$$ESCAPE_END$ | |
177 | ---- | |
178 | bind "c" | |
179 | ||
180 | prompt TEMPLATE "Template to include: " read srecode-read-template-name | |
181 | ||
182 | template include :srt | |
183 | ---- | |
184 | $ESCAPE_START$>:$?TEMPLATE$$ESCAPE_END$ | |
185 | ---- | |
186 | bind "i" | |
187 | ||
188 | template includewrap :srt | |
189 | ---- | |
190 | $ESCAPE_START$<:$?TEMPLATE$$ESCAPE_END$$^$$ESCAPE_START$/$NAME$$ESCAPE_END$ | |
191 | ---- | |
192 | bind "w" | |
193 | ||
194 | template point :srt | |
195 | ---- | |
196 | $ESCAPE_START$^$ESCAPE_END$ | |
197 | ---- | |
198 | bind "p" | |
199 | ||
200 | template section :srt | |
201 | "Insert a section, or looping construct." | |
202 | ---- | |
203 | $ESCAPE_START$#$?NAME$$ESCAPE_END$ | |
204 | $^$ | |
205 | $ESCAPE_START$/$NAME$$ESCAPE_END$ | |
206 | ---- | |
207 | bind "s" | |
208 | ||
209 | template escape-start-quoted :srt | |
210 | "Escape Start" | |
211 | ---- | |
212 | $ESCAPE_START$ESCAPE_START$ESCAPE_END$ | |
213 | ---- | |
214 | bind "q" | |
215 | ||
216 | template escape-end-quoted :srt | |
217 | "Escape Start" | |
218 | ---- | |
219 | $ESCAPE_START$ESCAPE_END$ESCAPE_END$ | |
220 | ---- | |
221 | bind "e" | |
222 | ||
223 | ||
224 | ;; end |