mirror of https://github.com/Chizi123/.emacs.d.git

Chizi123
2018-11-18 c655eea759be1db69c5e6b45c228139d8390122a
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
;ELC
;;; Compiled
;;; in Emacs version 26.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.
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
(require 'map)
#@296 Using INNER and OUTER, traverse FORM, an arbitrary data structure.
INNER and OUTER are functions.  Apply INNER to each element of
FORM, building up a data structure of the same type, then apply
OUTER to the result.  Recognize cons, lists, alists, vectors and
hash tables.
 
(fn INNER OUTER FORM)
(defalias 'treepy-walk #[771 "\211<\203\211A\203\211A:\204@!A!B!\207\211<\203(\300\"!\207\301!\2039\302\303\300\"\"!\207\304!\203R\305\306\307\310\311\303    !\312\"\313\314%\"!\207!\207" [mapcar vectorp apply vector hash-table-p map-apply make-byte-code 514 "\300B!\207" vconcat [] 5 "\n\n(fn K V)"] 11 (#$ . 424)])
#@209 Perform a depth-first, post-order traversal of F applied to FORM.
Call F on each sub-form, use F's return value in place of the
original.  Recognize cons, lists, alists, vectors and
hash tables.
 
(fn F FORM)
(defalias 'treepy-postwalk #[514 "\300\301\302\"#\207" [treepy-walk apply-partially treepy-postwalk] 6 (#$ . 1070)])
#@103 Perform a depth-first, pre-order traversal of F applied to FORM.
Like `treepy-postwalk'.
 
(fn F FORM)
(defalias 'treepy-prewalk #[514 "\300\301\302\"\303!#\207" [treepy-walk apply-partially treepy-prewalk identity] 7 (#$ . 1405)])
#@112 Demonstrate the behavior of `treepy-postwalk' for FORM.
Return a list of each form as it is walked.
 
(fn FORM)
(defalias 'treepy-postwalk-demo #[257 "\300C\301\302\303\304\305\306!\307\"\310\311%\"\210\312\242!\207" [nil treepy-postwalk make-byte-code 257 "\300\300\242B\240\210\207" vconcat vector [] 4 "\n\n(fn X)" reverse] 9 (#$ . 1646)])
#@111 Demonstrate the behavior of `treepy-prewalk' for FORM.
Return a list of each form as it is walked.
 
(fn FORM)
(defalias 'treepy-prewalk-demo #[257 "\300C\301\302\303\304\305\306!\307\"\310\311%\"\210\312\242!\207" [nil treepy-prewalk make-byte-code 257 "\300\300\242B\240\210\207" vconcat vector [] 4 "\n\n(fn X)" reverse] 9 (#$ . 2000)])
#@284 Use SMAP to transform FORM by doing replacing operations.
Recursively replace in FORM keys in SMAP with their values.  Does
replacement at the leaves of the tree first.  The optional TESTFN
parameter is the function to be used by `map-contains-key'.
 
(fn SMAP FORM &optional TESTFN)
(defalias 'treepy-postwalk-replace #[770 "\300\301\302\303\304\305\"\306\"\307\310%\"\207" [treepy-postwalk make-byte-code 257 "\302\300\301#\203 \303\300\"\207\207" vconcat vector [map-contains-key map-elt] 5 "\n\n(fn X)"] 11 (#$ . 2351)])
#@282 Use SMAP to transform FORM by doing replacing operations.
Recursively replace in FORM keys in SMAP with their values.  Does
replacement at the root of the tree first.  The optional TESTFN
parameter is the function to be used by `map-contains-key'.
 
(fn SMAP FORM &optional TESTFN)
(defalias 'treepy-prewalk-replace #[770 "\300\301\302\303\304\305\"\306\"\307\310%\"\207" [treepy-prewalk make-byte-code 257 "\302\300\301#\203 \303\300\"\207\207" vconcat vector [map-contains-key map-elt] 5 "\n\n(fn X)"] 11 (#$ . 2890)])
#@112 Return context for this LOC.
If KEY is given, only return this key's value in context.
 
(fn LOC &optional KEY)
(defalias 'treepy--context #[513 "@A\211\203\203\300\"\202\211\207" [map-elt] 6 (#$ . 3425)])
#@60 Assoc in CONTEXT a key K with a value V.
 
(fn CONTEXT K V)
(defalias 'treepy--context-assoc-1 #[771 "\300\"\203\301\302\303\304\305\306\"\307\"\310\311%\"\207BB\207" [map-contains-key mapcar make-byte-code 257 "\211@\300\232\203 \300\301B\207\207" vconcat vector [] 3 "\n\n(fn ENTRY)"] 11 (#$ . 3646)])
#@73 Immutable map association in CONTEXT using KVS.
 
(fn CONTEXT &rest KVS)
(defalias 'treepy--context-assoc #[385 "\300\301\302\303\"#\207" [seq-reduce #[514 "\300\301\"\300\302\"\211\303#\266\202\207" [seq--elt-safe 1 0 treepy--context-assoc-1] 10 "\n\n(fn CONTEXT KV)"] seq-partition 2] 7 (#$ . 3968)])
#@130 Return meta information for this LOC.
If KEY is given, only return this key's value in meta
information.
 
(fn LOC &optional KEY)
(defalias 'treepy--meta #[513 "A\203 \300\"\202\211\207" [map-elt] 6 (#$ . 4286)])
#@53 Bind OBJ with some META information.
 
(fn OBJ META)
(defalias 'treepy--with-meta #[514 "B\207" [] 4 (#$ . 4511)])
#@164 Return a joining of LEFT-CHILDREN and RIGHT-CHILDREN.
Reverses LEFT-CHILDREN so that they are correctly ordered as in
the tree.
 
(fn LEFT-CHILDREN RIGHT-CHILDREN)
(defalias 'treepy--join-children #[514 "\300\301!\"\207" [append reverse] 5 (#$ . 4634)])
#@98 Create a lexical context using LOC VARS.
Execute BODY in this context.
 
(fn LOC VARS &rest BODY)
(defalias 'treepy--with-loc '(macro . #[642 "\300\301\302\303\304\305!\306\"\307\310%\"\311BB\207" [mapcar make-byte-code 257 "\301\302\"\203 \303\304\300DD\207\301\305\"\203\306\307\300DD\207\211\307\300\310\311\312\313!P!DED\207" vconcat vector [memql 'node node treepy-node 'context context treepy--context quote intern ":" symbol-name] 9 "\n\n(fn V)" let*] 10 (#$ . 4895)]))
(byte-code "\300\301\302\303#\300\207" [function-put treepy--with-loc lisp-indent-function defun] 4)
#@415 Create a new zipper structure.
 
BRANCHP is a function that, given a node, returns t if it can
have children, even if it currently doesn't.
 
CHILDREN is a function that, given a branch node, returns a seq
of its children.
 
MAKE-NODE is a function that, given an existing node and a seq of
children, returns a new branch node with the supplied children.
 
ROOT is the root node.
 
(fn BRANCHP CHILDREN MAKE-NODE ROOT)
(defalias 'treepy-zipper #[1028 "\300\301B\302B\303B\304BE\"\207" [treepy--with-meta nil :branchp :children :make-node] 10 (#$ . 5491)])
#@65 Return a zipper for nested lists, given a ROOT list.
 
(fn ROOT)
(defalias 'treepy-list-zip #[257 "\300\301\302\303$\207" [#[514 "\207" [] 3 "\n\n(fn _ CHILDREN)"] treepy-zipper listp identity] 7 (#$ . 6055)])
#@69 Return a zipper for nested vectors, given a ROOT vector.
 
(fn ROOT)
(defalias 'treepy-vector-zip #[257 "\300\301\302\303$\207" [#[514 "\300\301\"\207" [apply vector] 5 "\n\n(fn _ CHILDREN)"] #[257 "\300\301\"\207" [seq-into list] 4 "\n\n(fn CS)"] treepy-zipper vectorp] 8 (#$ . 6272)])
#@35 Return the node at LOC.
 
(fn LOC)
(defalias 'treepy-node #[257 "\211@@\207" [] 2 (#$ . 6570)])
#@52 Return t if the node at LOC is a branch.
 
(fn LOC)
(defalias 'treepy-branch-p #[257 "\300\301\"\302!!\207" [treepy--meta :branchp treepy-node] 4 (#$ . 6671)])
#@78 Return a children list of the node at LOC, which must be a branch.
 
(fn LOC)
(defalias 'treepy-children #[257 "\300!\203\301\302\"\303!!\207\304\305!\207" [treepy-branch-p treepy--meta :children treepy-node error "Called children on a leaf node"] 4 (#$ . 6838)])
#@175 Return a new branch node.
Given an existing LOC, NODE and new CHILDREN, creates a new LOC
with them.  The LOC is only used to supply the constructor.
 
(fn LOC NODE CHILDREN)
(defalias 'treepy-make-node #[771 "\300\301\"\"\207" [treepy--meta :make-node] 6 (#$ . 7113)])
#@60 Return a list of nodes leading to the given LOC.
 
(fn LOC)
(defalias 'treepy-path #[257 "\300\301\302\"!\207" [reverse treepy--context :pnodes] 5 (#$ . 7391)])
#@59 Return a list of the left siblings of this LOC.
 
(fn LOC)
(defalias 'treepy-lefts #[257 "\300\301\302\"!\207" [reverse treepy--context :l] 5 (#$ . 7558)])
#@60 Return a list of the right siblings of this LOC.
 
(fn LOC)
(defalias 'treepy-rights #[257 "\300\301\"\207" [treepy--context :r] 4 (#$ . 7720)])
#@93 Return the loc of the leftmost child of the node at this LOC.
nil if no children.
 
(fn LOC)
(defalias 'treepy-down #[257 "\300!\205O\301!\302!\303!\303\304\"\305\306\"\307\310\"\211\205G\311\312C\304    \2034\n    B\2027\nCB\313\nB\314B\257\315 !\"\266\202\266\202\266\203\262\207" [treepy-branch-p treepy-children treepy-node treepy--context :pnodes seq-drop 1 seq--elt-safe 0 treepy--with-meta :l :ppath :r treepy--meta] 16 (#$ . 7871)])
#@84 Return the loc of the parent of the node at this LOC.
nil if at the top.
 
(fn LOC)
(defalias 'treepy-up #[257 "\300!\301\302\"\301\303\"\301\304\"\301\305\"\301\306\"\205K@\307\203@\310    \311\fB\"#\205<\312\304\313#B\202DB\314\n!\"\262\207" [treepy-node treepy--context :pnodes :ppath :changed\? :l :r treepy--with-meta treepy-make-node treepy--join-children treepy--context-assoc t treepy--meta] 16 (#$ . 8336)])
#@102 Zip from LOC all the way up and return the root node.
Reflect any alterations to the tree.
 
(fn LOC)
(defalias 'treepy-root #[257 "\300!\301\232\203\f\302!\207\211\303!\211\262\203\211\262\202 \302!\207" [treepy--context :end treepy-node treepy-up] 4 (#$ . 8786)])
#@112 Return the loc of the right sibling of the node at this LOC.
nil if there's no more right sibilings.
 
(fn LOC)
(defalias 'treepy-right #[257 "\300!\301!\301\302\"\301\303\"\211<\203\211\202\211\304B\305\306\"\307\310\"\211\205B\205B\311\312\n\302 \fB\303%B\313\f!\"\266\202\266\202\262\207" [treepy-node treepy--context :l :r nil seq-drop 1 seq--elt-safe 0 treepy--with-meta treepy--context-assoc treepy--meta] 18 (#$ . 9068)])
#@131 Return the loc of the rightmost sibling of the node at this LOC.
If LOC is already the rightmost sibiling, return self.
 
(fn LOC)
(defalias 'treepy-rightmost #[257 "\300!\301!\301\302\"\301\303\"\2035\211\2035\304\305!@\306\302\307\n\310    !B\"\303\311%B\312!\"\2026\207" [treepy-node treepy--context :l :r treepy--with-meta last treepy--context-assoc treepy--join-children butlast nil treepy--meta] 15 (#$ . 9527)])
#@102 Return the loc of the left sibling of the node at this LOC.
nil if no more left sibilings.
 
(fn LOC)
(defalias 'treepy-left #[257 "\300!\301!\301\302\"\301\303\"\2058\2058\304\305\"\306\307\"\211\310\311    \302\303\fB%B\312 !\"\266\202\266\202\207" [treepy-node treepy--context :l :r seq-drop 1 seq--elt-safe 0 treepy--with-meta treepy--context-assoc treepy--meta] 18 (#$ . 9966)])
#@129 Return the loc of the leftmost sibling of the node at this LOC.
If LOC is already the leftmost sibiling, return self.
 
(fn LOC)
(defalias 'treepy-leftmost #[257 "\300!\301!\301\302\"\301\303\"\2035\2035\304\305!@\306\302\307\303\310\311\n!\f\nB\"%B\312!\"\2026\207" [treepy-node treepy--context :l :r treepy--with-meta last treepy--context-assoc [] treepy--join-children butlast treepy--meta] 16 (#$ . 10371)])
#@83 Return the leftmost descendant of the given LOC.
(ie, down repeatedly).
 
(fn LOC)
(defalias 'treepy-leftmost-descendant #[257 "\300!\203\301!\262\202\207" [treepy-branch-p treepy-down] 3 (#$ . 10805)])
#@113 Insert as the left sibiling of this LOC'S node the ITEM.
Return same loc with sibilings updated.
 
(fn LOC ITEM)
(defalias 'treepy-insert-left #[514 "\300!\301!\301\302\"\204\303\304!\202'\305\306\302B\307\310%B\311!\"\207" [treepy-node treepy--context :l error "Insert at top" treepy--with-meta treepy--context-assoc :changed\? t treepy--meta] 13 (#$ . 11021)])
#@113 Insert as the right sibling of this LOC's node the ITEM.
Return same loc with sibilings updated.
 
(fn LOC ITEM)
(defalias 'treepy-insert-right #[514 "\300!\301!\301\302\"\204\303\304!\202'\305\306\302B\307\310%B\311!\"\207" [treepy-node treepy--context :r error "Insert at top" treepy--with-meta treepy--context-assoc :changed\? t treepy--meta] 13 (#$ . 11405)])
#@82 Replace the node in this LOC with the given NODE, without moving.
 
(fn LOC NODE)
(defalias 'treepy-replace #[514 "\300!\301\302\303\304#B\305!\"\207" [treepy--context treepy--with-meta treepy--context-assoc :changed\? t treepy--meta] 9 (#$ . 11789)])
#@86 Replace the node at this LOC with the value of (F node ARGS).
 
(fn LOC F &rest ARGS)
(defalias 'treepy-edit #[642 "\300\301\302!#\"\207" [treepy-replace apply treepy-node] 9 (#$ . 12050)])
#@113 Insert as the leftmost child of this LOC's node the ITEM.
Return same loc with children updated.
 
(fn LOC ITEM)
(defalias 'treepy-insert-child #[514 "\300\301\302!\303!B#\"\207" [treepy-replace treepy-make-node treepy-node treepy-children] 10 (#$ . 12251)])
#@114 Insert as the rightmost child of this LOC'S node the ITEM.
Return same loc with children updated.
 
(fn LOC ITEM)
(defalias 'treepy-append-child #[514 "\300\301\302!\303\304!C\"#\"\207" [treepy-replace treepy-make-node treepy-node append treepy-children] 10 (#$ . 12523)])
#@101 Remove the node at LOC.
Return the loc that would have preceded it in a depth-first
walk.
 
(fn LOC)
(defalias 'treepy-remove #[257 "\300!\300\301\"\300\302\"\300\303\"\300\304\"\204\305\306!\202nG\307V\203U\310@\311\303A\312\313%B\314!\"\315\316!\205A\317!\211\262\203O\320!\262\2028\266\202\202n\310\321@#\205h\311\312\313#B\314!\"\207" [treepy--context :pnodes :ppath :l :r error "Remove at top" 0 treepy--with-meta treepy--context-assoc :changed\? t treepy--meta nil treepy-branch-p treepy-children treepy-rightmost treepy-make-node] 14 (#$ . 12810)])
#@194 Move to the next LOC in the hierarchy, depth-first in preorder.
When reaching the end, returns a distinguished loc detectable via
`treepy-end-p'.  If already at the end, stays there.
 
(fn LOC)
(defalias 'treepy--preorder-next #[257 "\300!\301\232\203    \207\211\302!\203\303!\206D\304!\206D\211\305\306!\2037\304\306!!\211\262\2047\306!\262\202\211\206B\307!\301B\305B\266\202\207" [treepy--context :end treepy-branch-p treepy-down treepy-right nil treepy-up treepy-node] 7 (#$ . 13411)])
#@195 Move to the next LOC in the hierarchy, depth-first in postorder.
When reaching the end, returns a distinguished loc detectable via
`treepy-end-p'.  If already at the end, stays there.
 
(fn LOC)
(defalias 'treepy--postorder-next #[257 "\300!\301\232\203    \207\302!\204\303!\301B\304B\207\305!\211\205!\306!\262\206)\302!\207" [treepy--context :end treepy-up treepy-node nil treepy-right treepy-leftmost-descendant] 4 (#$ . 13925)])
#@184 Move to the next LOC in the hierarchy, depth-first.
Use ORDER if given.  Possible values for ORDER are `:preorder' and
`:postorder', defaults to the former.
 
(fn LOC &optional ORDER)
(defalias 'treepy-next #[513 "\211\206\300\301\302\"\203\303!\202\"\301\304\"\203\305!\202\"\306\307!\207" [:preorder memql ':preorder treepy--preorder-next ':postorder treepy--postorder-next error "Unrecognized order"] 6 (#$ . 14374)])
#@113 Move to the previous LOC in the hierarchy, depth-first preorder.
If already at the root, returns nil.
 
(fn LOC)
(defalias 'treepy--preorder-prev #[257 "\300!\301\203#\302!\205\303!\211\262\203\304!\262\202\202&\305!\207" [treepy-left nil treepy-branch-p treepy-children treepy-rightmost treepy-up] 5 (#$ . 14813)])
#@114 Move to the previous LOC in the hierarchy, depth-first postorder.
If already at the root, returns nil.
 
(fn LOC)
(defalias 'treepy--postorder-prev #[257 "\300!\203\f\301\302!!\207\303!\204\304!\262\202\f\303!\207" [treepy-branch-p treepy-rightmost treepy-down treepy-left treepy-up] 4 (#$ . 15152)])
#@188 Move to the previous LOC in the hierarchy, depth-first.
Use ORDER if given.  Possible values for ORDER are `:preorder' and `:postorder',
defaults to the former.
 
(fn LOC &optional ORDER)
(defalias 'treepy-prev #[513 "\211\206\300\301\302\"\203\303!\202\"\301\304\"\203\305!\202\"\306\307!\207" [:preorder memql ':preorder treepy--preorder-prev ':postorder treepy--postorder-prev error "Unrecognized order"] 6 (#$ . 15469)])
#@69 Return t if LOC represents the end of a depth-first walk.
 
(fn LOC)
(defalias 'treepy-end-p #[257 "\300!\301\232\207" [treepy--context :end] 3 (#$ . 15911)])
(provide 'treepy)