-
Notifications
You must be signed in to change notification settings - Fork 4
/
paredit.tex
380 lines (275 loc) · 7.35 KB
/
paredit.tex
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
% Copyright © 2013 Joe Littlejohn, 2008 drenweb.usma.edu
%
% Permission is granted to copy, distribute and/or modify this document
% under the terms of the GNU Free Documentation License, Version 1.3
% or any later version published by the Free Software Foundation;
% with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
%
% http://www.emacswiki.org/FDL
\documentclass[10pt,landscape,a4paper]{article}
\usepackage{extsizes}
\usepackage[utf8]{inputenc}
\usepackage[landscape,a4paper,margin=0.5cm]{geometry}
\usepackage{multicol}
\usepackage{titlesec}
\usepackage{courier}
\usepackage{color}
\usepackage[usenames]{xcolor}
\title{Paredit Cheatsheet}
% remove paragraph indent and compress spacing
\titleformat{\section}{\normalfont\bfseries}{\thesection}{0em}{}
\titlespacing{\section}{0em}{0.8em}{0.5em}
\setlength{\parskip}{0.1cm plus1mm minus1mm}
\setlength{\parindent}{0cm}
% tabbing environment with less vertical space above & below
\newenvironment{nstabbing}
{\setlength{\topsep}{-\parskip}%
\setlength{\partopsep}{0.2em}%
\tabbing}
{\endtabbing}
% reduce font size for code examples slightly
\let\oldtt\ttfamily \def\ttfamily{\oldtt\small}
% remove page numbering
\pagenumbering{gobble}
\begin{document}
\newcommand{\cursor}{\texttt{\textcolor{red}{\textbf{|}}}}
\begin{multicols}{4}
\section*{\Large{Paredit Cheatsheet}}
\section*{\large{Basic Insertion Commands}}
\textbf{paredit-open-round} \texttt{(}
{\ttfamily
(a b \cursor c d)\\
(a b (\cursor) c d)
(foo "bar \cursor baz" quux)\\
(foo "bar (\cursor baz" quux)
}
\textbf{paredit-close-round} \texttt{)}
{\ttfamily
(a b \cursor c \space\space)\\
(a b c)\cursor
; Hello,\cursor{} world\\
; Hello,)\cursor{} world
}
\textbf{paredit-close-round-and-newline} \texttt{M-)}
{\ttfamily
(defun f (x\cursor{} \space))\\
(defun f (x\cursor{} \space)\\
)
; (Foo.\cursor\\
; (Foo.\cursor
}
\textbf{paredit-open-square} \texttt{[}
{\ttfamily
(a b \cursor c d)\\
(a b [\cursor] c d)
(foo "bar \cursor baz" quux)\\
(foo "bar [\cursor baz" quux)
}
\textbf{paredit-close-square} \texttt{]}
{\ttfamily
(define-key keymap [frob\cursor{} \space] 'frobnicate)\\
(define-key keymap [frob]\cursor{} 'frobnicate)
; [Bar.\cursor\\
; [Bar.]\cursor
}
\textbf{paredit-doublequote} \texttt{"}
{\ttfamily
(frob grovel \cursor full lexical)\\
(frob grovel "\cursor " full lexical)
(foo "bar \cursor baz" quux)\\
(foo "bar \textbackslash"\cursor baz" quux)
}
\textbf{paredit-meta-doublequote} \texttt{M-"}
{\ttfamily
\begin{nstabbing}
(foo\={} "bar \cursor baz" quux)\\
(foo "bar baz"\\
\>\cursor quux)
\end{nstabbing}
(foo \cursor(bar \#\textbackslash x "baz \textbackslash\textbackslash{} quux") zot)\\
(foo "\cursor(bar \#\textbackslash\textbackslash x \textbackslash"baz \textbackslash\textbackslash\textbackslash\textbackslash{} quux\textbackslash")" zot)
}
\textbf{paredit-backslash} \texttt{\textbackslash}
{\ttfamily
(string \#\cursor)\\
Escaping character... (x)\\
(string \#\textbackslash x\cursor)
"foo\cursor bar"\\
Escaping character... (")\\
"foo\textbackslash"\cursor bar"
}
\textbf{paredit-comment-dwim} \texttt{M-;}
{\ttfamily
\begin{nstabbing}
(foo \cursor bar) \space ; baz \space \space \space \space \=\\
(foo bar) \>; \cursor baz
\end{nstabbing}
\begin{nstabbing}
(frob grovel)\cursor \space \space \space \space \space \space \space \space\=\\
(frob grovel) \>;\cursor
\end{nstabbing}
\cursor(defun hello-world ...)\\
;;; \cursor\\
(defun hello-world ...)
}
\textbf{paredit-newline} \texttt{C-j}
{\ttfamily
\begin{nstabbing}
(let ((n (frobbotz))) \cursor (display (+n 1)\\
port))
\end{nstabbing}
\begin{nstabbing}
(\=let ((n (f\=robbotz)))\\
\>\cursor (display (+n 1)\\
\>\>
port))
\end{nstabbing}
}
\section*{\large{Deleting \& Killing}}
\textbf{paredit-forward-delete} \\\texttt{C-d, <delete>, <deletechar>}
{\ttfamily
(quu\cursor{}x "zot")\\
(quu\cursor{} "zot")
(quux \cursor"zot")\\
(quux "\cursor zot")\\
(quux "\cursor ot")
(foo (\cursor) bar)\\
(foo \cursor{} bar)
\cursor(foo bar)\\
(\cursor foo bar)
}
\textbf{paredit-backward-delete} \texttt{DEL}
{\ttfamily
("zot" q\cursor uux)\\
("zot" \cursor uux)
("zot"\cursor{} quux)\\
("zot\cursor" quux)\\
("zo\cursor" quux)
(foo (\cursor) bar)\\
(foo \cursor{} bar)
(foo bar)\cursor\\
(foo bar\cursor)
}
\textbf{paredit-kill} \texttt{C-k}
{\ttfamily
(foo bar)\cursor \space \space \space ; Useless comment!\\
(foo bar)\cursor
(\cursor foo bar) \space \space \space ; Useful comment!\\
(\cursor) \space \space \space ; Useful comment!
\cursor(foo bar) \space \space \space ; Useless line!\\
\cursor
\begin{nstabbing}
(f\=oo "\cursor bar baz"\\
\>quux)\\
(foo "\cursor"\\
\>quux)
\end{nstabbing}
}
\textbf{paredit-forward-kill-word} \texttt{M-d}
{\ttfamily
\cursor(foo bar) \space \space \space ; baz\\
(\cursor{} bar) \space \space \space ; baz\\
(\cursor) \space \space \space ; baz\\
() \space \space \space ;\cursor
;;;\cursor{} Frobnicate\\
(defun frobnicate ...)\\
;;;\cursor\\
(defun frobnicate ...)\\
;;;\\
(\cursor{} frobnicate ...)
}
\section*{\large{Movement \& Navigation}}
\textbf{paredit-forward} \texttt{C-M-f}
{\ttfamily
(foo \cursor(bar baz) quux)\\
(foo (bar baz)\cursor{} quux)
(foo (bar)\cursor)\\
(foo (bar))\cursor
}
\textbf{paredit-backward} \texttt{C-M-b}
{\ttfamily
(foo (bar baz)\cursor{} quux)\\
(foo \cursor(bar baz) quux)
(\cursor(foo) bar)\\
\cursor((foo) bar)
}
\section*{\large{Depth-Changing Commands}}
\textbf{paredit-wrap-around} \texttt{M-(}
{\ttfamily
(foo \cursor bar baz)\\
(foo (\cursor bar) baz)
}
\textbf{paredit-splice-sexp} \texttt{M-s}
{\ttfamily
(foo (bar\cursor{} baz) quux)\\
(foo bar\cursor{} baz quux)
}
\textbf{paredit-splice-sexp-killing-backward} \\\texttt{M-<up>, ESC <up>}
{\ttfamily
(foo (let ((x 5)) \cursor(sqrt n)) bar)\\
(foo \cursor(sqrt n) bar)
}
\textbf{paredit-splice-sexp-killing-forward} \\\texttt{M-<down>, ESC <down>}
{\ttfamily
(a (b c\cursor{} d e) f)\\
(a b c\cursor{} f)
}
\textbf{paredit-raise-sexp} \texttt{M-r}
{\ttfamily
(dynamic-wind in (lambda () \cursor body) out)\\
(dynamic-wind in \cursor body out)\\
\cursor body
}
\section*{\large{Barfage \& Slurpage}}
\textbf{paredit-forward-slurp-sexp} \\\texttt{C-), C-<right>}
{\ttfamily
(foo (bar \cursor baz) quux zot)\\
(foo (bar \cursor baz quux) zot)
(a b ((c\cursor{} d)) e f)\\
(a b ((c\cursor{} d) e) f)
}
\textbf{paredit-forward-barf-sexp} \\\texttt{C-\}, C-<left>}
{\ttfamily
(foo (bar \cursor baz quux) zot)\\
(foo (bar \cursor baz) quux zot)
}
\textbf{paredit-backward-slurp-sexp} \\\texttt{C-(, C-M-<left>, ESC C-<left>}
{\ttfamily
(foo bar (baz\cursor{} quux) zot)\\
(foo (bar\cursor{} baz quux) zot)
(a b ((c\cursor{} d)) e f)\\
(a (b (c\cursor{} d) e) f)
}
\textbf{paredit-backward-barf-sexp} \\\texttt{C-\{, C-M-<right>, ESC C-<right>}
{\ttfamily
(foo (bar baz \cursor quux) zot)\\
(foo bar (baz \cursor quux) zot)
}
\section*{\large{Miscellaneous Commands}}
\textbf{paredit-split-sexp} \texttt{M-S}
{\ttfamily
(hello\cursor{} world)\\
(hello)\cursor{} (world)
"Hello, \cursor world!"\\
"Hello, "\cursor{} "world!"
}
\textbf{paredit-join-sexp} \texttt{M-J}
{\ttfamily
(hello)\cursor{} (world)\\
(hello\cursor{} world)
"Hello, "\cursor{} "world!"\\
"Hello, \cursor world!"
hello-\\
\cursor \space \space world\\
hello-\cursor world
}
\textbf{paredit-recentre-on-sexp} \texttt{C-c C-M-l}
{\ttfamily
No examples
}
\textbf{paredit-retindent-defun} \texttt{M-q}
{\ttfamily
No examples
}
\end{multicols}
\end{document}