]>
Commit | Line | Data |
---|---|---|
1 | ;ELC\1c\0\0\0 | |
2 | ;;; Compiled | |
3 | ;;; in Emacs version 28.2 | |
4 | ;;; with all optimizations. | |
5 | ||
6 | ||
7 | ||
8 | (autoload 'slot-value "eieio") | |
9 | #@50 Remove whitespace at the beginning of S. | |
10 | ||
11 | (fn S)\1f | |
12 | (defalias 's-trim-left #[257 "\300 \301\302\ 2\"\216\303\304\ 3\"\203\17\0\305\306\307\211\ 5$\202\18\0\ 1)\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] string-match "\\`[ \n\r]+" replace-match "" t] 7 (#$ . 115)]) | |
13 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-trim-left pure t side-effect-free] 5) | |
14 | #@44 Remove whitespace at the end of S. | |
15 | ||
16 | (fn S)\1f | |
17 | (defalias 's-trim-right #[257 "\300 \301\302\ 2\"\216\303\304\ 3\"\203\17\0\305\306\307\211\ 5$\202\18\0\ 1)\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] string-match "[ \n\r]+\\'" replace-match "" t] 7 (#$ . 524)]) | |
18 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-trim-right pure t side-effect-free] 5) | |
19 | #@58 Remove whitespace at the beginning and end of S. | |
20 | ||
21 | (fn S)\1f | |
22 | (defalias 's-trim #[257 "\300\301\ 2!!\207" [s-trim-left s-trim-right] 4 (#$ . 929)]) | |
23 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-trim pure t side-effect-free] 5) | |
24 | #@71 Convert all adjacent whitespace characters to a single space. | |
25 | ||
26 | (fn S)\1f | |
27 | (defalias 's-collapse-whitespace #[257 "\300\301\302\ 3#\207" [replace-regexp-in-string "[ \n\r]+" " "] 5 (#$ . 1181)]) | |
28 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-collapse-whitespace pure t side-effect-free] 5) | |
29 | #@142 Unindent S which has BOL (beginning of line) indicators. | |
30 | BOL will default to pipe. You can optionally supply your own. | |
31 | ||
32 | (fn S &optional BOL)\1f | |
33 | (defalias 's-unindent #[513 "\301\ 1\206\ 6\0\302\ 1\18\303\304\305\ 3!P\306\ 6\ 6#)\207" [case-fold-search nil "|" s-replace-regexp "^[[:space:]]*" regexp-quote ""] 8 (#$ . 1496)]) | |
34 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-unindent pure t side-effect-free] 5) | |
35 | #@229 Split S into substrings bounded by matches for regexp SEPARATOR. | |
36 | If OMIT-NULLS is non-nil, zero-length substrings are omitted. | |
37 | ||
38 | This is a simple wrapper around the built-in `split-string'. | |
39 | ||
40 | (fn SEPARATOR S &optional OMIT-NULLS)\1f | |
41 | (defalias 's-split #[770 "\300 \301\302\ 2\"\216\303\ 3\ 5\ 4#)\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] split-string] 8 (#$ . 1920)]) | |
42 | (byte-code "\300\301\302\303#\300\207" [function-put s-split side-effect-free t] 4) | |
43 | #@205 Split S up to N times into substrings bounded by matches for regexp SEPARATOR. | |
44 | ||
45 | If OMIT-NULLS is non-nil, zero-length substrings are omitted. | |
46 | ||
47 | See also `s-split'. | |
48 | ||
49 | (fn SEPARATOR S N &optional OMIT-NULLS)\1f | |
50 | (defalias 's-split-up-to #[1027 "\300 \301\302\ 2\"\216\303\304\305\306\307\"r\211q\210\301\310\ 2\"\216\ 6\ 6c\210eb\262\ 3\311\ 6\b\304\307#\203N\0\303\ 6\ 6W\203N\0\ 2\303\224{\ 5\203<\0\211\312\232\204A\0\211\ 3B\262\ 3\210\303\225b\262\ 3\ 5S\262\ 6\202\1e\0\ 2d{\ 5\203[\0\211\312\232\204`\0\211\ 3B\262\ 3\210*\210\211\237\266\202)\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] 0 nil generate-new-buffer " *temp*" t #[0 "\301\300!\205 \0\302\300!\207" [V0 buffer-name kill-buffer] 2] re-search-forward ""] 12 (#$ . 2413)]) | |
51 | (byte-code "\300\301\302\303#\300\207" [function-put s-split-up-to side-effect-free t] 4) | |
52 | #@64 Splits S into a list of strings on newline characters. | |
53 | ||
54 | (fn S)\1f | |
55 | (defalias 's-lines #[257 "\300\301\ 2\"\207" [s-split "\\(\r\n\\|[\n\r]\\)"] 4 (#$ . 3236)]) | |
56 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-lines pure t side-effect-free] 5) | |
57 | #@84 Join all the strings in STRINGS with SEPARATOR in between. | |
58 | ||
59 | (fn SEPARATOR STRINGS)\1f | |
60 | (defalias 's-join #[514 "\300\301\ 2\ 4#\207" [mapconcat identity] 6 (#$ . 3500)]) | |
61 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-join pure t side-effect-free] 5) | |
62 | #@68 Join all the string arguments into one string. | |
63 | ||
64 | (fn &rest STRINGS)\1f | |
65 | (defalias 's-concat #[128 "\300\301\ 2\"\207" [apply concat] 4 (#$ . 3773)]) | |
66 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-concat pure t side-effect-free] 5) | |
67 | #@42 Concatenate PREFIX and S. | |
68 | ||
69 | (fn PREFIX S)\1f | |
70 | (defalias 's-prepend #[514 "\ 1\ 1P\207" [] 4 (#$ . 4028)]) | |
71 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-prepend pure t side-effect-free] 5) | |
72 | #@42 Concatenate S and SUFFIX. | |
73 | ||
74 | (fn SUFFIX S)\1f | |
75 | (defalias 's-append #[514 "\211\ 2P\207" [] 4 (#$ . 4239)]) | |
76 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-append pure t side-effect-free] 5) | |
77 | #@103 Splice NEEDLE into S at position N. | |
78 | 0 is the beginning of the string, -1 is the end. | |
79 | ||
80 | (fn NEEDLE N S)\1f | |
81 | (defalias 's-splice #[771 "\ 1\300W\203\19\0\211\300\ 3T\ 3G\\O\301\302\ 4Z\ 3\"\ 1\ 5\ 2Q\207\303\ 2\ 2\"\ 1\ 3\ 3GO\ 1\ 5\ 2Q\207" [0 s-right -1 s-left] 8 (#$ . 4452)]) | |
82 | #@52 Make a string of S repeated NUM times. | |
83 | ||
84 | (fn NUM S)\1f | |
85 | (defalias 's-repeat #[514 "\300\ 2\301V\203\13\0\ 1\ 1B\262\ 1\ 2S\262\ 3\202\ 1\0\302\303\ 2\"\207" [nil 0 apply concat] 6 (#$ . 4696)]) | |
86 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-repeat pure t side-effect-free] 5) | |
87 | #@52 Remove SUFFIX if it is at end of S. | |
88 | ||
89 | (fn SUFFIX S)\1f | |
90 | (defalias 's-chop-suffix #[514 "\ 1G[\ 1G\ 3GY\203\19\0\ 2\ 2\ 2\300O\230\203\19\0\ 1\301\ 2O\207\ 1\207" [nil 0] 7 (#$ . 4978)]) | |
91 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-chop-suffix pure t side-effect-free] 5) | |
92 | #@84 Remove SUFFIXES one by one in order, if they are at the end of S. | |
93 | ||
94 | (fn SUFFIXES S)\1f | |
95 | (defalias 's-chop-suffixes #[514 "\ 1\203\12\0\300\ 2@\ 2\"\262\ 1\ 1A\262\ 2\202\0\0\207" [s-chop-suffix] 5 (#$ . 5253)]) | |
96 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-chop-suffixes pure t side-effect-free] 5) | |
97 | #@58 Remove PREFIX if it is at the start of S. | |
98 | ||
99 | (fn PREFIX S)\1f | |
100 | (defalias 's-chop-prefix #[514 "\ 1G\ 1G\ 3GY\203\18\0\ 2\ 2\300\ 3O\230\203\18\0\ 1\ 1\301O\207\ 1\207" [0 nil] 7 (#$ . 5562)]) | |
101 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-chop-prefix pure t side-effect-free] 5) | |
102 | #@86 Remove PREFIXES one by one in order, if they are at the start of S. | |
103 | ||
104 | (fn PREFIXES S)\1f | |
105 | (defalias 's-chop-prefixes #[514 "\ 1\203\12\0\300\ 2@\ 2\"\262\ 1\ 1A\262\ 2\202\0\0\207" [s-chop-prefix] 5 (#$ . 5842)]) | |
106 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-chop-prefixes pure t side-effect-free] 5) | |
107 | #@66 Returns the longest prefix S1 and S2 have in common. | |
108 | ||
109 | (fn S1 S2)\1f | |
110 | (defalias 's-shared-start #[514 "\300\ 2\301\ 4G\ 4\301\ 6\ 6G&\ 6\211\302=\203\14\0\ 2\207\ 2\301\303\ 3!SO\207" [compare-strings 0 t abs] 9 (#$ . 6153)]) | |
111 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-shared-start pure t side-effect-free] 5) | |
112 | #@66 Returns the longest suffix S1 and S2 have in common. | |
113 | ||
114 | (fn S1 S2)\1f | |
115 | (defalias 's-shared-end #[514 "\ 1G\ 1G\ 1\ 1^\300\211\ 2W\203%\0\ 5\ 4\ 2ZSH\ 5\ 4\ 3ZSHU\203%\0\211T\262\ 1\202\b\0\211\300U\203-\0\301\207\ 5\ 1[\302O\207" [0 "" nil] 10 (#$ . 6472)]) | |
116 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-shared-end pure t side-effect-free] 5) | |
117 | #@58 Remove one trailing `\n`, `\r` or `\r\n` from S. | |
118 | ||
119 | (fn S)\1f | |
120 | (defalias 's-chomp #[257 "\300\301\ 2\"\207" [s-chop-suffixes ("\n" "\r")] 4 (#$ . 6808)]) | |
121 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-chomp pure t side-effect-free] 5) | |
122 | #@223 If S is longer than LEN, cut it down and add ELLIPSIS to the end. | |
123 | ||
124 | The resulting string, including ellipsis, will be LEN characters | |
125 | long. | |
126 | ||
127 | When not specified, ELLIPSIS defaults to ‘...’. | |
128 | ||
129 | (fn LEN S &optional ELLIPSIS)\1f | |
130 | (defalias 's-truncate #[770 "\211\204\a\0\300\262\ 1\ 1G\ 3V\203\e\0\301\302\ 3\303\ 6\ 6\ 5GZO\ 3#\207\ 1\207" ["..." format "%s%s" 0] 9 (#$ . 7066)]) | |
131 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-truncate pure t side-effect-free] 5) | |
132 | #@68 If S is longer than LEN, wrap the words with newlines. | |
133 | ||
134 | (fn LEN S)\1f | |
135 | (defalias 's-word-wrap #[514 "\301 \302\303\ 2\"\216\304\305\306\"r\211q\210\302\307\ 2\"\216\ 2c\210\ 3\18\310ed\"\210)ed{*\262\ 1)\207" [fill-column match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] generate-new-buffer " *temp*" t #[0 "\301\300!\205 \0\302\300!\207" [V0 buffer-name kill-buffer] 2] fill-region] 7 (#$ . 7533)]) | |
136 | (byte-code "\300\301\302\303#\300\207" [function-put s-word-wrap side-effect-free t] 4) | |
137 | #@77 If S is shorter than LEN, pad it with spaces so it is centered. | |
138 | ||
139 | (fn LEN S)\1f | |
140 | (defalias 's-center #[514 "\300\ 2\ 2GZ]\301\302\ 2\303\"\304\"\ 2\301\305\ 4\303\"\304\"Q\207" [0 make-string ceiling 2 32 floor] 9 (#$ . 8043)]) | |
141 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-center pure t side-effect-free] 5) | |
142 | #@80 If S is shorter than LEN, pad it with PADDING on the left. | |
143 | ||
144 | (fn LEN PADDING S)\1f | |
145 | (defalias 's-pad-left #[771 "\300\ 3\ 2GZ]\301\ 1\302\ 5!\"\ 2P\207" [0 make-string string-to-char] 8 (#$ . 8369)]) | |
146 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-pad-left pure t side-effect-free] 5) | |
147 | #@81 If S is shorter than LEN, pad it with PADDING on the right. | |
148 | ||
149 | (fn LEN PADDING S)\1f | |
150 | (defalias 's-pad-right #[771 "\300\ 3\ 2GZ]\ 1\301\ 2\302\ 6\ 6!\"P\207" [0 make-string string-to-char] 9 (#$ . 8669)]) | |
151 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-pad-right pure t side-effect-free] 5) | |
152 | #@53 Returns up to the LEN first chars of S. | |
153 | ||
154 | (fn LEN S)\1f | |
155 | (defalias 's-left #[514 "\211G\ 2V\203\f\0\211\300\ 3O\207\207" [0] 5 (#$ . 8973)]) | |
156 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-left pure t side-effect-free] 5) | |
157 | #@52 Returns up to the LEN last chars of S. | |
158 | ||
159 | (fn LEN S)\1f | |
160 | (defalias 's-right #[514 "\211G\211\ 3V\203\ f\0\ 1\ 1\ 4Z\ 2O\207\ 1\207" [] 6 (#$ . 9215)]) | |
161 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-right pure t side-effect-free] 5) | |
162 | #@48 Remove the first LEN chars from S. | |
163 | ||
164 | (fn LEN S)\1f | |
165 | (defalias 's-chop-left #[514 "\211G\211\ 3V\203\r\0\ 1\ 3\ 2O\207\300\207" [""] 6 (#$ . 9457)]) | |
166 | #@47 Remove the last LEN chars from S. | |
167 | ||
168 | (fn LEN S)\1f | |
169 | (defalias 's-chop-right #[514 "\211G\211\ 3V\203\ f\0\ 1\300\ 2\ 5ZO\207\301\207" [0 ""] 7 (#$ . 9596)]) | |
170 | #@179 Does S end with SUFFIX? | |
171 | ||
172 | If IGNORE-CASE is non-nil, the comparison is done without paying | |
173 | attention to case differences. | |
174 | ||
175 | Alias: `s-suffix?' | |
176 | ||
177 | (fn SUFFIX S &optional IGNORE-CASE)\1f | |
178 | (defalias 's-ends-with\? #[770 "\ 1G\ 3GZ\211\300Y\205\19\0\301\ 4\302\211\ 6\ 6\ 5\302\ 6\b&\a\303=\207" [0 compare-strings nil t] 12 (#$ . 9743)]) | |
179 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-ends-with\? pure t side-effect-free] 5) | |
180 | #@246 Does S start with PREFIX? | |
181 | ||
182 | If IGNORE-CASE is non-nil, the comparison is done without paying | |
183 | attention to case differences. | |
184 | ||
185 | Alias: `s-prefix?'. This is a simple wrapper around the built-in | |
186 | `string-prefix-p'. | |
187 | ||
188 | (fn PREFIX S &optional IGNORE-CASE)\1f | |
189 | (defalias 's-starts-with\? #[770 "\300\ 3\ 3\ 3#\207" [string-prefix-p] 7 (#$ . 10170)]) | |
190 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-starts-with\? pure t side-effect-free] 5) | |
191 | #@12 | |
192 | ||
193 | (fn VAL)\1f | |
194 | (defalias 's--truthy\? #[257 "\211??\207" [] 2 (#$ . 10618)]) | |
195 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s--truthy\? pure t side-effect-free] 5) | |
196 | #@158 Does S contain NEEDLE? | |
197 | ||
198 | If IGNORE-CASE is non-nil, the comparison is done without paying | |
199 | attention to case differences. | |
200 | ||
201 | (fn NEEDLE S &optional IGNORE-CASE)\1f | |
202 | (defalias 's-contains\? #[770 "\211\18\302\303\ 4!\ 3\304\305\19\306\ 3\ 3\ 3#)\266\203!)\207" [case-fold-search inhibit-changing-match-data s--truthy\? regexp-quote nil t string-match] 11 (#$ . 10808)]) | |
203 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-contains\? pure t side-effect-free] 5) | |
204 | #@94 Is S1 equal to S2? | |
205 | ||
206 | This is a simple wrapper around the built-in `string-equal'. | |
207 | ||
208 | (fn S1 S2)\1f | |
209 | (defalias 's-equals\? #[514 "\ 1\ 1\230\207" [] 4 (#$ . 11272)]) | |
210 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-equals\? pure t side-effect-free] 5) | |
211 | #@95 Is S1 less than S2? | |
212 | ||
213 | This is a simple wrapper around the built-in `string-lessp'. | |
214 | ||
215 | (fn S1 S2)\1f | |
216 | (defalias 's-less\? #[514 "\ 1\ 1\231\207" [] 4 (#$ . 11541)]) | |
217 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-less\? pure t side-effect-free] 5) | |
218 | #@170 Does REGEXP match S? | |
219 | If START is non-nil the search starts at that index. | |
220 | ||
221 | This is a simple wrapper around the built-in `string-match-p'. | |
222 | ||
223 | (fn REGEXP S &optional START)\1f | |
224 | (defalias 's-matches\? #[770 "\301\ 3\ 3\ 3\302\18\303\ 3\ 3\ 3#)\266\203!\207" [inhibit-changing-match-data s--truthy\? t string-match] 11 (#$ . 11808)]) | |
225 | (byte-code "\300\301\302\303#\300\207" [function-put s-matches\? side-effect-free t] 4) | |
226 | #@39 Is S nil or the empty string? | |
227 | ||
228 | (fn S)\1f | |
229 | (defalias 's-blank\? #[257 "\211?\206\b\0\211\300\230\207" [""] 3 (#$ . 12212)]) | |
230 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-blank\? pure t side-effect-free] 5) | |
231 | #@74 Is S nil or the empty string or string only contains whitespace? | |
232 | ||
233 | (fn S)\1f | |
234 | (defalias 's-blank-str\? #[257 "\300\ 1!\206\v\0\300\301\ 2!!\207" [s-blank\? s-trim] 4 (#$ . 12443)]) | |
235 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-blank-str\? pure t side-effect-free] 5) | |
236 | #@52 Is S anything but nil or the empty string? | |
237 | ||
238 | (fn S)\1f | |
239 | (defalias 's-present\? #[257 "\300\ 1!?\207" [s-blank\?] 3 (#$ . 12731)]) | |
240 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-present\? pure t side-effect-free] 5) | |
241 | #@62 Return S if it's `s-present?', otherwise return nil. | |
242 | ||
243 | (fn S)\1f | |
244 | (defalias 's-presence #[257 "\300\ 1!\205\a\0\211\207" [s-present\?] 3 (#$ . 12970)]) | |
245 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-presence pure t side-effect-free] 5) | |
246 | #@49 Are all the letters in S in lower case? | |
247 | ||
248 | (fn S)\1f | |
249 | (defalias 's-lowercase\? #[257 "\302\18\303\ 1\302\304\19\305\ 3\ 3\ 3#)\266\203)?\207" [case-fold-search inhibit-changing-match-data nil "[[:upper:]]" t string-match] 8 (#$ . 13228)]) | |
250 | (byte-code "\300\301\302\303#\300\207" [function-put s-lowercase\? side-effect-free t] 4) | |
251 | #@49 Are all the letters in S in upper case? | |
252 | ||
253 | (fn S)\1f | |
254 | (defalias 's-uppercase\? #[257 "\302\18\303\ 1\302\304\19\305\ 3\ 3\ 3#)\266\203)?\207" [case-fold-search inhibit-changing-match-data nil "[[:lower:]]" t string-match] 8 (#$ . 13545)]) | |
255 | (byte-code "\300\301\302\303#\300\207" [function-put s-uppercase\? side-effect-free t] 4) | |
256 | #@64 Are there both lower case and upper case letters in S? | |
257 | ||
258 | (fn S)\1f | |
259 | (defalias 's-mixedcase\? #[257 "\302\18\303\304\ 2\302\305\19\306\ 3\ 3\ 3#)\266\203\205 \0\307\ 2\302\305\19\306\ 3\ 3\ 3#)\266\203!)\207" [case-fold-search inhibit-changing-match-data nil s--truthy\? "[[:lower:]]" t string-match "[[:upper:]]"] 9 (#$ . 13862)]) | |
260 | #@81 In S, is the first letter upper case, and all other letters lower case? | |
261 | ||
262 | (fn S)\1f | |
263 | (defalias 's-capitalized\? #[257 "\302\18\303\304\ 2\302\305\19\306\ 3\ 3\ 3#)\266\203!)\207" [case-fold-search inhibit-changing-match-data nil s--truthy\? "^[[:upper:]][^[:upper:]]*$" t string-match] 9 (#$ . 14171)]) | |
264 | (byte-code "\300\301\302\303#\300\207" [function-put s-capitalized\? side-effect-free t] 4) | |
265 | #@24 Is S a number? | |
266 | ||
267 | (fn S)\1f | |
268 | (defalias 's-numeric\? #[257 "\301\302\ 2\303\304\18\305\ 3\ 3\ 3#)\266\203!\207" [inhibit-changing-match-data s--truthy\? "^[0-9]+$" nil t string-match] 9 (#$ . 14555)]) | |
269 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-numeric\? pure t side-effect-free] 5) | |
270 | #@45 Replaces OLD with NEW in S. | |
271 | ||
272 | (fn OLD NEW S)\1f | |
273 | (defalias 's-replace #[771 "\300\301\ 4!\ 3\ 3\302\211%\207" [replace-regexp-in-string regexp-quote t] 9 (#$ . 14855)]) | |
274 | (byte-code "\300\301\302\303#\300\301\304\303#\305\306\307\"\207" [function-put s-replace pure t side-effect-free defalias s-replace-regexp replace-regexp-in-string] 5) | |
275 | #@48 Get the value of KEY in ALIST. | |
276 | ||
277 | (fn ALIST KEY)\1f | |
278 | (defalias 's--aget #[514 "\300\ 1\ 3\"A\207" [assoc-string] 5 (#$ . 15188)]) | |
279 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s--aget pure t side-effect-free] 5) | |
280 | #@100 REPLACEMENTS is a list of cons-cells. Each `car` is replaced with `cdr` in S. | |
281 | ||
282 | (fn REPLACEMENTS S)\1f | |
283 | (defalias 's-replace-all #[514 "\301\18\302\303\304\305\ 5\"!\306\307\ 5\"\ 3\310\211%)\207" [case-fold-search nil replace-regexp-in-string regexp-opt mapcar car make-closure #[257 "\301\300\ 2\"\207" [V0 s--aget] 4 "\n\n(fn IT)"] t] 8 (#$ . 15421)]) | |
284 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-replace-all pure t side-effect-free] 5) | |
285 | #@92 Convert S to lower case. | |
286 | ||
287 | This is a simple wrapper around the built-in `downcase'. | |
288 | ||
289 | (fn S)\1f | |
290 | (defalias 's-downcase #[257 "\211\227\207" [] 2 (#$ . 15879)]) | |
291 | (byte-code "\300\301\302\303#\300\207" [function-put s-downcase side-effect-free t] 4) | |
292 | #@90 Convert S to upper case. | |
293 | ||
294 | This is a simple wrapper around the built-in `upcase'. | |
295 | ||
296 | (fn S)\1f | |
297 | (defalias 's-upcase #[257 "\211\226\207" [] 2 (#$ . 16126)]) | |
298 | (byte-code "\300\301\302\303#\300\207" [function-put s-upcase side-effect-free t] 4) | |
299 | #@85 Convert S first word's first character to upper and the rest to lower case. | |
300 | ||
301 | (fn S)\1f | |
302 | (defalias 's-capitalize #[257 "\211\300\301O\226\ 1\301\302O\227P\207" [0 1 nil] 5 (#$ . 16367)]) | |
303 | (byte-code "\300\301\302\303#\300\207" [function-put s-capitalize side-effect-free t] 4) | |
304 | #@147 Convert in S each word's first character to upper and the rest to lower case. | |
305 | ||
306 | This is a simple wrapper around the built-in `capitalize'. | |
307 | ||
308 | (fn S)\1f | |
309 | (defalias 's-titleize #[257 "\300\ 1!\207" [capitalize] 3 (#$ . 16643)]) | |
310 | (byte-code "\300\301\302\303#\300\207" [function-put s-titleize side-effect-free t] 4) | |
311 | #@235 Threads S through the forms. Inserts S as the last item | |
312 | in the first form, making a list of it if it is not a list | |
313 | already. If there are more forms, inserts the first form as the | |
314 | last item in second form, etc. | |
315 | ||
316 | (fn S FORM &rest MORE)\1f | |
317 | (defalias 's-with '(macro . #[642 "\211\204\17\0\ 1<\203\13\0\ 1@\300\ 3A\ 5C\"B\207\ 1\ 3D\207\301\211\ 4\ 4E\ 2BB\207" [append s-with] 7 (#$ . 16954)])) | |
318 | (byte-code "\300\301\302\303#\210\300\301\304\305#\207" [put s-with edebug-form-spec (form &rest [&or (function &rest form) fboundp]) lisp-indent-function 1] 4) | |
319 | #@179 Returns first index of NEEDLE in S, or nil. | |
320 | ||
321 | If IGNORE-CASE is non-nil, the comparison is done without paying | |
322 | attention to case differences. | |
323 | ||
324 | (fn NEEDLE S &optional IGNORE-CASE)\1f | |
325 | (defalias 's-index-of #[770 "\211\18\302\ 3!\ 2\303\304\19\305\ 3\ 3\ 3#)\266\203)\207" [case-fold-search inhibit-changing-match-data regexp-quote nil t string-match] 10 (#$ . 17487)]) | |
326 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-index-of pure t side-effect-free] 5) | |
327 | #@34 Return the reverse of S. | |
328 | ||
329 | (fn S)\1f | |
330 | (defalias 's-reverse #[257 "\301 \302\303\ 2\"\216\304\ 2!\203J\0\ 1\305\ 1\306\"\262\ 1\306\307\310!\210\ 1\203B\0\ 1\211A\262\ 3\242C\311\ 3@\b\"\2039\0\ 2\211A\262\ 4\242\ 1B\262\ 1\202$\0\211\237\ 2\244\266\202\202\19\0\211\260\ 1\266\202\202T\0\ 1\305\ 1\306\"\262\ 1\237\260\ 1)\207" [ucs-normalize-combining-chars match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] multibyte-string-p append nil require ucs-normalize memql] 8 (#$ . 17951)]) | |
331 | (byte-code "\300\301\302\303#\300\301\304\303#\300\207" [function-put s-reverse pure t side-effect-free] 5) | |
332 | #@203 Return a list of matches for REGEX in STRING. | |
333 | ||
334 | Each element itself is a list of matches, as per | |
335 | `match-string'. Multiple matches at the same position will be | |
336 | ignored after the first. | |
337 | ||
338 | (fn REGEX STRING)\1f | |
339 | (defalias 's-match-strings-all #[514 "\300 \301\302\ 2\"\216\303\304\211\ 4GW\203E\0\305\ 5\ 5\ 3#\203E\0\304\224T\262\ 1\303\300 G\306\245\304\211\ 2U\204:\0\307\ 1\ 6\b\"\ 3B\262\ 3\211T\262\ 1\202$\0\ 2\237\ 5B\262\ 5\266\ 3\202 \0\ 1\237\266\202)\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] nil 0 string-match 2 match-string] 11 (#$ . 18531)]) | |
340 | (byte-code "\300\301\302\303#\300\207" [function-put s-match-strings-all side-effect-free t] 4) | |
341 | #@131 Return a list of matched positions for REGEXP in STRING. | |
342 | SUBEXP-DEPTH is 0 by default. | |
343 | ||
344 | (fn REGEXP STRING &optional SUBEXP-DEPTH)\1f | |
345 | (defalias 's-matched-positions-all #[770 "\211\204\a\0\300\262\ 1\301 \302\303\ 2\"\216\300\304\305\ 6\ 6\ 6\ 6\ 4#\2031\0\ 1\ 5GW\2031\0\ 3\224\ 4\225B\ 1B\262\ 1\300\225\262\ 2\202\10\0\211\237\266\202)\207" [0 match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] nil string-match] 10 (#$ . 19188)]) | |
346 | (byte-code "\300\301\302\303#\300\207" [function-put s-matched-positions-all side-effect-free t] 4) | |
347 | #@583 When the given expression matches the string, this function returns a list | |
348 | of the whole matching string and a string for each matched subexpressions. | |
349 | Subexpressions that didn't match are represented by nil elements | |
350 | in the list, except that non-matching subexpressions at the end | |
351 | of REGEXP might not appear at all in the list. That is, the | |
352 | returned list can be shorter than the number of subexpressions in | |
353 | REGEXP plus one. If REGEXP did not match the returned value is | |
354 | an empty list (nil). | |
355 | ||
356 | When START is non-nil the search will start at that index. | |
357 | ||
358 | (fn REGEXP S &optional START)\1f | |
359 | (defalias 's-match #[770 "\300 \301\302\ 2\"\216\303\ 4\ 4\ 4#\205;\0\300 \304\ 1\2037\0\ 1@\ 2A@\ 1\205(\0\211\205(\0\ 6\ 6\ 2\ 2O\211\ 4B\262\ 4\ 4AA\262\ 5\266\ 3\202\12\0\211\237\266\202)\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] string-match nil] 11 (#$ . 19721)]) | |
360 | (byte-code "\300\301\302\303#\300\207" [function-put s-match side-effect-free t] 4) | |
361 | #@60 Slices S up at every index matching REGEXP. | |
362 | ||
363 | (fn REGEXP S)\1f | |
364 | (defalias 's-slice-at #[514 "\300\ 1!\203 \0\211C\207\301\300\ 2!\204@\0\302 \303\304\ 2\"\216\305\ 4\ 4\306#\211\2032\0\ 3\307\ 2O\ 3B\262\ 3\ 3\ 1\301O\262\ 4\210\202;\0\ 3\ 3B\262\ 3\310\262\ 4\210)\210\202\n\0\211\237\207" [s-blank\? nil match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] string-match 1 0 ""] 8 (#$ . 20668)]) | |
365 | (byte-code "\300\301\302\303#\300\207" [function-put s-slice-at side-effect-free t] 4) | |
366 | #@37 Split S into list of words. | |
367 | ||
368 | (fn S)\1f | |
369 | (defalias 's-split-words #[257 "\301\302\303\18\304\305\306\304\307\306\ 6\b##)\310#\207" [case-fold-search s-split "[^[:word:]0-9]+" nil replace-regexp-in-string "\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2" "\\([[:upper:]]\\)\\([[:upper:]][0-9[:lower:]]\\)" t] 10 (#$ . 21145)]) | |
370 | (byte-code "\300\301\302\303#\300\207" [function-put s-split-words side-effect-free t] 4) | |
371 | #@96 Like MAPCAR, but applies a different function to the first element. | |
372 | ||
373 | (fn FN-HEAD FN-REST LIST)\1f | |
374 | (defalias 's--mapcar-head #[771 "\211\205\ e\0\ 2\ 1@!\300\ 3\ 3A\"B\207" [mapcar] 7 (#$ . 21554)]) | |
375 | #@38 Convert S to lowerCamelCase. | |
376 | ||
377 | (fn S)\1f | |
378 | (defalias 's-lower-camel-case #[257 "\300\301\302\303\304\305\ 6\ 6!#\"\207" [s-join "" s--mapcar-head downcase capitalize s-split-words] 8 (#$ . 21744)]) | |
379 | (byte-code "\300\301\302\303#\300\207" [function-put s-lower-camel-case side-effect-free t] 4) | |
380 | #@38 Convert S to UpperCamelCase. | |
381 | ||
382 | (fn S)\1f | |
383 | (defalias 's-upper-camel-case #[257 "\300\301\302\303\304\ 5!\"\"\207" [s-join "" mapcar capitalize s-split-words] 7 (#$ . 22033)]) | |
384 | (byte-code "\300\301\302\303#\300\207" [function-put s-upper-camel-case side-effect-free t] 4) | |
385 | #@34 Convert S to snake_case. | |
386 | ||
387 | (fn S)\1f | |
388 | (defalias 's-snake-case #[257 "\300\301\302\303\304\ 5!\"\"\207" [s-join "_" mapcar downcase s-split-words] 7 (#$ . 22301)]) | |
389 | (byte-code "\300\301\302\303#\300\207" [function-put s-snake-case side-effect-free t] 4) | |
390 | #@36 Convert S to dashed-words. | |
391 | ||
392 | (fn S)\1f | |
393 | (defalias 's-dashed-words #[257 "\300\301\302\303\304\ 5!\"\"\207" [s-join "-" mapcar downcase s-split-words] 7 (#$ . 22552)]) | |
394 | (byte-code "\300\301\302\303#\300\207" [function-put s-dashed-words side-effect-free t] 4) | |
395 | #@36 Convert S to spaced words. | |
396 | ||
397 | (fn S)\1f | |
398 | (defalias 's-spaced-words #[257 "\300\301\302\ 3!\"\207" [s-join " " s-split-words] 5 (#$ . 22809)]) | |
399 | (byte-code "\300\301\302\303#\300\207" [function-put s-spaced-words side-effect-free t] 4) | |
400 | #@41 Convert S to Capitalized words. | |
401 | ||
402 | (fn S)\1f | |
403 | (defalias 's-capitalized-words #[257 "\300\ 1!\301\302\303\ 3@!\304\305\ 5A\"B\"\207" [s-split-words s-join " " capitalize mapcar downcase] 8 (#$ . 23040)]) | |
404 | (byte-code "\300\301\302\303#\300\207" [function-put s-capitalized-words side-effect-free t] 4) | |
405 | #@39 Convert S to Titleized Words. | |
406 | ||
407 | (fn S)\1f | |
408 | (defalias 's-titleized-words #[257 "\300\301\302\303\304\ 5!\"\"\207" [s-join " " mapcar s-titleize s-split-words] 7 (#$ . 23333)]) | |
409 | (byte-code "\300\301\302\303#\300\207" [function-put s-titleized-words side-effect-free t] 4) | |
410 | #@36 Convert S to its initials. | |
411 | ||
412 | (fn S)\1f | |
413 | (defalias 's-word-initials #[257 "\300\301\302\303\304\ 5!\"\"\207" [s-join "" mapcar #[257 "\211\300\301O\207" [0 1] 4 "\n\n(fn SS)"] s-split-words] 7 (#$ . 23601)]) | |
414 | (byte-code "\300\301\302\303#\304\305\306\307#\210\304\305\310\311#\207" [function-put s-word-initials side-effect-free t put s-format-resolve error-conditions (error s-format s-format-resolve) error-message "Cannot resolve a template to values"] 5) | |
415 | #@504 Format TEMPLATE with the function REPLACER. | |
416 | ||
417 | REPLACER takes an argument of the format variable and optionally | |
418 | an extra argument which is the EXTRA value from the call to | |
419 | `s-format'. | |
420 | ||
421 | Several standard `s-format' helper functions are recognized and | |
422 | adapted for this: | |
423 | ||
424 | (s-format "${name}" \='gethash hash-table) | |
425 | (s-format "${name}" \='aget alist) | |
426 | (s-format "$0" \='elt sequence) | |
427 | ||
428 | The REPLACER function may be used to do any other kind of | |
429 | transformation. | |
430 | ||
431 | (fn TEMPLATE REPLACER &optional EXTRA)\1f | |
432 | (defalias 's-format #[770 "\300 \301\302\ 2\"\216\303\304\301\305\ 6\ 6\ 6\ 6\ 6\ 6$\ 6\ 6\306\211%)\207" [match-data make-closure #[0 "\301\300!\207" [V0 set-match-data] 2] replace-regexp-in-string "\\$\\({\\([^}]+\\)}\\|[0-9]+\\)" #[257 "\303\304\ 2\"\211\203\f\0\211\202\12\0\305\303\306\ 4\"!\262\ 1\307 \310\311\ 2\"\216\300\312=\203(\0\300\ 2\301\"\202c\0\300\313=\2035\0\314\301\ 3\"\202c\0\300\315=\203B\0\300\301\ 3\"\202c\0\300\316=\203Q\0\317\301\320\ 4!\"\202c\0\321\302!\210\301\203`\0\300\ 2\301\"\202c\0\300\ 2!\211\203n\0\322\323\ 2\"\202r\0\324\325\ 5\"\262\ 1)\207" [V0 V1 V2 match-string 2 string-to-number 1 match-data make-closure #[0 "\301\300!\207" [V0 set-match-data] 2] gethash aget s--aget elt oref slot-value intern set-match-data format "%s" signal s-format-resolve] 7 "\n\n(fn MD)"] t] 11 (#$ . 24058)]) | |
433 | #@92 If `t' interpolate lisp values as lisp. | |
434 | ||
435 | `s-lex-format' inserts values with (format "%S").\1f | |
436 | (defvar s-lex-value-as-lisp nil (#$ . 25340)) | |
437 | #@33 Expand FMT into lisp. | |
438 | ||
439 | (fn FMT)\1f | |
440 | (defalias 's-lex-fmt|expand #[257 "\300\ 1\301\302\303\304\305\306\307\ 6 \"\"\"F\207" [s-format 'aget append (list) mapcar #[257 "\300\ 1A@\301\302\303\ 5A@!EE\207" [cons format (if s-lex-value-as-lisp "%S" "%s") intern] 7 "\n\n(fn MATCHES)"] s-match-strings-all "${\\([^}]+\\)}"] 11 (#$ . 25483)]) | |
441 | (byte-code "\300\301\302\303#\300\207" [function-put s-lex-fmt|expand side-effect-free t] 4) | |
442 | #@333 `s-format` with the current environment. | |
443 | ||
444 | FORMAT-STR may use the `s-format' variable reference to refer to | |
445 | any variable: | |
446 | ||
447 | (let ((x 1)) | |
448 | (s-lex-format "x is: ${x}")) | |
449 | ||
450 | The values of the variables are interpolated with "%s" unless | |
451 | the variable `s-lex-value-as-lisp' is `t' and then they are | |
452 | interpolated with "%S". | |
453 | ||
454 | (fn FORMAT-STR)\1f | |
455 | (defalias 's-lex-format '(macro . #[257 "\300\ 1!\207" [s-lex-fmt|expand] 3 (#$ . 25907)])) | |
456 | (put 's-lex-format 'edebug-form-spec '(form)) | |
457 | #@452 Count occurrences of `regexp' in `s'. | |
458 | ||
459 | `start', inclusive, and `end', exclusive, delimit the part of `s' to | |
460 | match. `start' and `end' are both indexed starting at 1; the initial | |
461 | character in `s' is index 1. | |
462 | ||
463 | This function starts looking for the next match from the end of the | |
464 | previous match. Hence, it ignores matches that overlap a previously | |
465 | found match. To count overlapping matches, use | |
466 | `s-count-matches-all'. | |
467 | ||
468 | (fn REGEXP S &optional START END)\1f | |
469 | (defalias 's-count-matches #[1026 "\300 \301\302\ 2\"\216\303\304\305\"r\211q\210\301\306\ 2\"\216\ 4c\210eb\210\307\ 6\ 6\ 5\206\"\0\310\ 5\206'\0d#*\262\ 1)\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] generate-new-buffer " *temp*" t #[0 "\301\300!\205 \0\302\300!\207" [V0 buffer-name kill-buffer] 2] count-matches 1] 10 (#$ . 26382)]) | |
470 | (byte-code "\300\301\302\303#\300\207" [function-put s-count-matches side-effect-free t] 4) | |
471 | #@487 Count occurrences of `regexp' in `s'. | |
472 | ||
473 | `start', inclusive, and `end', exclusive, delimit the part of `s' to | |
474 | match. `start' and `end' are both indexed starting at 1; the initial | |
475 | character in `s' is index 1. | |
476 | ||
477 | This function starts looking for the next match from the second | |
478 | character of the previous match. Hence, it counts matches that | |
479 | overlap a previously found match. To ignore matches that overlap a | |
480 | previously found match, use `s-count-matches'. | |
481 | ||
482 | (fn REGEXP S &optional START END)\1f | |
483 | (defalias 's-count-matches-all #[1026 "\300\301\ 5\"\302\211\ 5\ 5\203\10\0\ 5S\202\11\0\302\ 5\205\17\0\ 5SO\303 \304\305\ 2\"\216\ 2\ 2GW\203;\0\306\ 5\ 3\ 5\307O\"\2034\0\ 3T\262\ 4\ 2T\262\ 3\202\1f\0)\210\ 2\207" [format "^%s" 0 match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] s-matches\? nil] 14 (#$ . 27295)]) | |
484 | (byte-code "\300\301\302\303#\300\207" [function-put s-count-matches-all side-effect-free t] 4) | |
485 | #@213 Wrap string S with PREFIX and optionally SUFFIX. | |
486 | ||
487 | Return string S with PREFIX prepended. If SUFFIX is present, it | |
488 | is appended, otherwise PREFIX is used as both prefix and | |
489 | suffix. | |
490 | ||
491 | (fn S PREFIX &optional SUFFIX)\1f | |
492 | (defalias 's-wrap #[770 "\ 1\ 3\ 2\206\a\0\ 3Q\207" [] 6 (#$ . 28187)]) | |
493 | (byte-code "\300\301\302\303#\300\301\304\303#\305\306\307\"\210\305\310\311\"\210\305\312\313\"\210\305\314\315\"\210\305\316\317\"\210\305\320\321\"\210\305\322\323\"\210\305\324\325\"\210\305\326\327\"\210\305\330\331\"\210\305\332\333\"\210\305\334\335\"\210\305\336\335\"\210\305\337\340\"\210\305\341\335\"\210\305\342\317\"\210\305\343\317\"\210\305\344\345\"\210\346\347!\207" [function-put s-wrap pure t side-effect-free defalias s-blank-p s-blank\? s-blank-str-p s-blank-str\? s-capitalized-p s-capitalized\? s-contains-p s-contains\? s-ends-with-p s-ends-with\? s-equals-p s-equals\? s-less-p s-less\? s-lowercase-p s-lowercase\? s-matches-p s-matches\? s-mixedcase-p s-mixedcase\? s-numeric-p s-numeric\? s-prefix-p s-starts-with\? s-prefix\? s-present-p s-present\? s-starts-with-p s-suffix-p s-suffix\? s-uppercase-p s-uppercase\? provide s] 5) |