-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparedit.elc
568 lines (562 loc) · 72.3 KB
/
paredit.elc
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
;ELC
;;; Compiled by [email protected] on Sat Apr 27 15:23:05 2013
;;; from file /home/nitro/.emacs.d/paredit.el
;;; in Emacs version 24.3.1
;;; with all optimizations.
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst paredit-version 23)
(defconst paredit-beta-p nil)
(defalias 'paredit-xemacs-p #[nil "\300\207" [nil] 1])
(defalias 'paredit-gnu-emacs-p #[nil "\300 ?\207" [paredit-xemacs-p] 1])
#@56 Exhaustive COND.
Signal an error if no clause matches.
(defalias 'xcond '(macro . #[(&rest clauses) "\301\302\303\"B\207" [clauses cond append ((t (error "XCOND lost.")))] 4 (#$ . 702)]))
(byte-code "\300\301\302\303!\203\f \303\202 \304\"\207" [defalias paredit-warn fboundp warn message] 4)
(defvar paredit-sexp-error-type (byte-code "\301\302!rq\210\303\216\304c\210\305\306\307\217+\207" [#1=#:temp-buffer generate-new-buffer " *temp*" ((byte-code "\301!\203\n \302!\210\301\207" [#1# buffer-name kill-buffer] 2)) "(" condition (backward-sexp) ((error (byte-code "@\301=\203 \302\303\304\305\306\307\310&\210@\207" [condition error paredit-warn "%s%s%s%s%s" "Paredit is unable to discriminate" " S-expression parse errors from" " other errors. " " This may cause obscure problems. " " Please upgrade Emacs."] 7)))] 3))
(defalias 'paredit-handle-sexp-errors '(macro . #[(body &rest handler) "\303\304 \nBF\207" [body paredit-sexp-error-type handler condition-case nil] 5]))
(put 'paredit-handle-sexp-errors 'lisp-indent-function 1)
(defalias 'paredit-ignore-sexp-errors '(macro . #[(&rest body) "\301\302B\303BB\207" [body paredit-handle-sexp-errors progn (nil)] 3]))
(put 'paredit-ignore-sexp-errors 'lisp-indent-function 0)
#@36 Keymap for the paredit minor mode.
(defvar paredit-mode-map (make-sparse-keymap) (#$ . 1949))
#@71 Function to tell whether unbalanced text should inhibit Paredit Mode.
(defvar paredit-override-check-parens-function #[(condition) "\210\301\207" [condition nil] 1] (#$ . 2049))
#@93 Non-nil if Paredit mode is enabled.
Use the command `paredit-mode' to change this variable.
(defvar paredit-mode nil (#$ . 2234))
(make-variable-buffer-local 'paredit-mode)
#@347 Minor mode for pseudo-structurally editing Lisp code.
With a prefix argument, enable Paredit Mode even if there are
unbalanced parentheses in the buffer.
Paredit behaves badly if parentheses are unbalanced, so exercise
caution when forcing Paredit Mode to be enabled, and consider
fixing unbalanced parentheses instead.
\<paredit-mode-map>
(defalias 'paredit-mode #[(&optional arg) "\304 \305=\203 \n?\202 \306 !\307V\211\203! \204! \310\311\312\217\210\313\314\n\203+ \315\202, \316\"\210\317\320!\203M \304 \203@ \304 \232\203M \321\322\n\203J \323\202K \324\"\210)\325 \210\n\207" [#1=#:last-message arg paredit-mode current-prefix-arg current-message toggle prefix-numeric-value 0 condition (check-parens) ((error (byte-code " !\204 \303\304 @ A\"\210\303\207" [paredit-override-check-parens-function condition paredit-mode nil signal] 3))) run-hooks paredit-mode-hook paredit-mode-on-hook paredit-mode-off-hook called-interactively-p any message "Paredit mode %sabled" "en" "dis" force-mode-line-update] 4 (#$ . 2414) (list (or current-prefix-arg 'toggle))])
(byte-code "\301\302\303\304\300!\205\n \305\211%\207" [paredit-mode-map add-minor-mode paredit-mode " Paredit" boundp nil] 6)
(defalias 'paredit-override-check-parens-interactively #[(condition) "\301\302\303\"!\207" [condition y-or-n-p format "Enable Paredit Mode despite condition %S? "] 4])
#@49 Turn on pseudo-structural editing of Lisp code.
(defalias 'enable-paredit-mode #[nil "\300\301!\207" [paredit-mode 1] 2 (#$ . 3797) nil])
#@50 Turn off pseudo-structural editing of Lisp code.
(defalias 'disable-paredit-mode #[nil "\300\301!\207" [paredit-mode -1] 2 (#$ . 3941) nil])
(defvar paredit-backward-delete-key (byte-code "\300 \203 \301\207\302 \203 \303\207\304\305!\207" [paredit-xemacs-p "BS" paredit-gnu-emacs-p "DEL" error "XCOND lost."] 2))
(defvar paredit-forward-delete-keys (byte-code "\300 \203 \301\207\302 \203 \303\207\304\305!\207" [paredit-xemacs-p ("DEL") paredit-gnu-emacs-p ("<delete>" "<deletechar>") error "XCOND lost."] 2))
#@56 List of paredit commands with their keys and examples.
(defvar paredit-commands nil (#$ . 4463))
(byte-code "\303\304\305\306\307\310\311\312\313\314\315\316DF\317\320\321\322\323\324\325DE\326\327B\330B \331B\332\333\334 P\335B\336BBBBBBBBBBBBBBBBBB\313\207" [paredit-forward-delete-keys paredit-backward-delete-key paredit-commands "Basic Insertion Commands" ("(" paredit-open-round ("(a b |c d)" "(a b (|) c d)") ("(foo \"bar |baz\" quux)" "(foo \"bar (|baz\" quux)")) (")" paredit-close-round ("(a b |c )" "(a b c)|") ("; Hello,| world!" "; Hello,)| world!")) ("M-)" paredit-close-round-and-newline ("(defun f (x| ))" "(defun f (x)\n |)") ("; (Foo.|" "; (Foo.)|")) ("[" paredit-open-square ("(a b |c d)" "(a b [|] c d)") ("(foo \"bar |baz\" quux)" "(foo \"bar [|baz\" quux)")) ("]" paredit-close-square ("(define-key keymap [frob| ] 'frobnicate)" "(define-key keymap [frob]| 'frobnicate)") ("; [Bar.|" "; [Bar.]|")) ("\"" paredit-doublequote ("(frob grovel |full lexical)" "(frob grovel \"|\" full lexical)" "(frob grovel \"\"| full lexical)") ("(foo \"bar |baz\" quux)" "(foo \"bar \\\"|baz\" quux)") ("(frob grovel) ; full |lexical" "(frob grovel) ; full \"|lexical")) "M-\"" paredit-meta-doublequote ("(foo \"bar |baz\" quux)" "(foo \"bar baz\"\n |quux)") "(foo |(bar #\\x \"baz \\\\ quux\") zot)" "(foo \"|(bar #\\\\x \\\"baz \\\\\\\\ quux\\\")\" zot)" ("\\" paredit-backslash ("(string #|)\n ; Character to escape: x" "(string #\\x|)") ("\"foo|bar\"\n ; Character to escape: \"" "\"foo\\\"|bar\"")) (";" paredit-semicolon ("|(frob grovel)" ";|(frob grovel)") ("(frob |grovel)" "(frob ;|grovel\n )") ("(frob |grovel (bloit\n zargh))" "(frob ;|grovel\n (bloit\n zargh))") ("(frob grovel) |" "(frob grovel) ;|")) ("M-;" paredit-comment-dwim ("(foo |bar) ; baz" "(foo bar) ; |baz") ("(frob grovel)|" "(frob grovel) ;|") ("(zot (foo bar)\n|\n (baz quux))" "(zot (foo bar)\n ;; |\n (baz quux))") ("(zot (foo bar) |(baz quux))" "(zot (foo bar)\n ;; |\n (baz quux))") ("|(defun hello-world ...)" ";;; |\n(defun hello-world ...)")) "C-j" paredit-newline "(let ((n (frobbotz))) |(display (+ n 1)\nport))" "(let ((n (frobbotz)))\n |(display (+ n 1)\n port))" "Deleting & Killing" "C-d" (paredit-forward-delete ("(quu|x \"zot\")" "(quu| \"zot\")") ("(quux |\"zot\")" "(quux \"|zot\")" "(quux \"|ot\")") ("(foo (|) bar)" "(foo | bar)") ("|(foo bar)" "(|foo bar)")) (paredit-backward-delete ("(\"zot\" q|uux)" "(\"zot\" |uux)") ("(\"zot\"| quux)" "(\"zot|\" quux)" "(\"zo|\" quux)") ("(foo (|) bar)" "(foo | bar)") ("(foo bar)|" "(foo bar|)")) ("C-k" paredit-kill ("(foo bar)| ; Useless comment!" "(foo bar)|") ("(|foo bar) ; Useful comment!" "(|) ; Useful comment!") ("|(foo bar) ; Useless line!" "|") ("(foo \"|bar baz\"\n quux)" "(foo \"|\"\n quux)")) ("M-d" paredit-forward-kill-word ("|(foo bar) ; baz" "(| bar) ; baz" "(|) ; baz" "() ;|") (";;;| Frobnicate\n(defun frobnicate ...)" ";;;|\n(defun frobnicate ...)" ";;;\n(| frobnicate ...)")) "M-" (paredit-backward-kill-word ("(foo bar) ; baz\n(quux)|" "(foo bar) ; baz\n(|)" "(foo bar) ; |\n()" "(foo |) ; \n()" "(|) ; \n()")) ("Movement & Navigation" ("C-M-f" paredit-forward ("(foo |(bar baz) quux)" "(foo (bar baz)| quux)") ("(foo (bar)|)" "(foo (bar))|")) ("C-M-b" paredit-backward ("(foo (bar baz)| quux)" "(foo |(bar baz) quux)") ("(|(foo) bar)" "|((foo) bar)")) ("C-M-u" paredit-backward-up) ("C-M-d" paredit-forward-down) ("C-M-p" paredit-backward-down) ("C-M-n" paredit-forward-up) "Depth-Changing Commands" ("M-(" paredit-wrap-round ("(foo |bar baz)" "(foo (|bar) baz)")) ("M-s" paredit-splice-sexp ("(foo (bar| baz) quux)" "(foo bar| baz quux)")) (("M-<up>" "ESC <up>") paredit-splice-sexp-killing-backward ("(foo (let ((x 5)) |(sqrt n)) bar)" "(foo |(sqrt n) bar)")) (("M-<down>" "ESC <down>") paredit-splice-sexp-killing-forward ("(a (b c| d e) f)" "(a b c| f)")) ("M-r" paredit-raise-sexp ("(dynamic-wind in (lambda () |body) out)" "(dynamic-wind in |body out)" "|body")) ("M-?" paredit-convolute-sexp ("(let ((x 5) (y 3)) (frob |(zwonk)) (wibblethwop))" "(frob |(let ((x 5) (y 3)) (zwonk) (wibblethwop)))")) "Barfage & Slurpage" (("C-)" "C-<right>") paredit-forward-slurp-sexp ("(foo (bar |baz) quux zot)" "(foo (bar |baz quux) zot)") ("(a b ((c| d)) e f)" "(a b ((c| d) e) f)")) (("C-}" "C-<left>") paredit-forward-barf-sexp ("(foo (bar |baz quux) zot)" "(foo (bar |baz) quux zot)")) (("C-(" "C-M-<left>" "ESC C-<left>") paredit-backward-slurp-sexp ("(foo bar (baz| quux) zot)" "(foo (bar baz| quux) zot)") ("(a b ((c| d)) e f)" "(a (b (c| d)) e f)")) (("C-{" "C-M-<right>" "ESC C-<right>") paredit-backward-barf-sexp ("(foo (bar baz |quux) zot)" "(foo bar (baz |quux) zot)")) "Miscellaneous Commands" ("M-S" paredit-split-sexp ("(hello| world)" "(hello)| (world)") ("\"Hello, |world!\"" "\"Hello, \"| \"world!\"")) ("M-J" paredit-join-sexps ("(hello)| (world)" "(hello| world)") ("\"Hello, \"| \"world!\"" "\"Hello, |world!\"") ("hello-\n| world" "hello-|world")) ("C-c C-M-l" paredit-recenter-on-sexp) ("M-q" paredit-reindent-defun))] 19)
(defalias 'paredit-do-commands '(macro . #[(vars string-case &rest body) "@A@\3068\3078\310\f\311B\312\313\fD\314\314\315\316\fDDC\317\320\321\322\323\324\fEDFED\n\325\fDD \326\fDDEBBFE,\207" [vars examples fn keys spec string-case 2 3 dolist (paredit-commands) if stringp let k car cond ((stringp k) (list k)) ((listp k) k) t error "Invalid paredit command %s." cadr cddr body] 16]))
(put 'paredit-do-commands 'lisp-indent-function 2)
(defalias 'paredit-define-keys #[nil "\306\211\205d \n@\211;\204\\ @\211;\203 C\202* <\203&