122
122
(separator-end-row (plist-get input-mode :separator-end-row ))
123
123
(separator-col-separator (plist-get input-mode :separator-col-separator ))
124
124
(dashes (format-table-trim-row dashes separator-begin-row separator-end-row)))
125
- (-map 'length (split-string dashes
126
- (regexp-quote separator-col-separator)))))
125
+ (-map # 'length (split-string dashes
126
+ (regexp-quote separator-col-separator)))))
127
127
128
128
(defun format-table-split-row (row col-widths input-mode )
129
129
" Split the given string ROW based on the fixed positions listed in COL-WIDTHS and any additional information in INPUT-MODE."
163
163
(let ((last (make-list (length (car table)) 0 )))
164
164
(dolist (cur-row table last )
165
165
(setq last
166
- (-zip-with 'max (-map 'length cur-row) last )))))
166
+ (-zip-with # 'max (-map # 'length cur-row) last )))))
167
167
168
168
(defun format-table-render-row (row max-col-widths output-mode &optional pad-fn )
169
169
" Render a table row with the proper column separators and a newline.
170
170
171
171
Arguments are the list of values ROW, the list of MAX-COL-WIDTHS, and delimiter
172
172
information in OUTPUT-MODE. Optionally use PAD-FN to pad each column value,
173
173
otherwise values will be padded to the right with spaces."
174
- (let ((pad-fn (or pad-fn 'format-table-pad-right )))
174
+ (let ((pad-fn (or pad-fn # 'format-table-pad-right )))
175
175
(concat
176
176
(plist-get output-mode :begin-row )
177
177
(string-join
@@ -188,7 +188,7 @@ otherwise values will be padded to the right with spaces."
188
188
" Given the list of MAX-COL-WIDTHS and delimiter information in OUTPUT-MODE, render a row which separates the header row from the rest of the rows."
189
189
(concat (plist-get output-mode :separator-begin-row )
190
190
(string-join
191
- (-map 'format-table-generate-dash-string max-col-widths)
191
+ (-map # 'format-table-generate-dash-string max-col-widths)
192
192
(plist-get output-mode :separator-col-separator ))
193
193
(plist-get output-mode :separator-end-row )
194
194
hard-newline))
@@ -197,7 +197,7 @@ otherwise values will be padded to the right with spaces."
197
197
" Render the TABLE of values as a json string."
198
198
(let ((vec []))
199
199
(dolist (cur-row (plist-get table :body ) vec)
200
- (let ((rec (-zip-with 'cons (plist-get table :header ) cur-row)))
200
+ (let ((rec (-zip-with # 'cons (plist-get table :header ) cur-row)))
201
201
(setq vec (vconcat vec (list rec)))))
202
202
(json-encode vec)))
203
203
@@ -234,18 +234,18 @@ otherwise values will be padded to the right with spaces."
234
234
235
235
(defun format-table-parse-json-gather-column-values (obj )
236
236
" Gather cdrs from alist OBJ."
237
- (-map 'cdr obj))
237
+ (-map # 'cdr obj))
238
238
239
239
(defun format-table-parse-json-gather-column-names (obj )
240
240
" Gather cars from alist OBJ."
241
- (-map 'car obj))
241
+ (-map # 'car obj))
242
242
243
243
(defun format-table-parse-json (str )
244
244
" Parse the json string STR to a table of values as a plist."
245
245
(let* ((json-key-type 'string )
246
246
(vec (append (json-read-from-string str) nil ))
247
247
(header (format-table-parse-json-gather-column-names (car vec)))
248
- (body (-map 'format-table-parse-json-gather-column-values vec)))
248
+ (body (-map # 'format-table-parse-json-gather-column-values vec)))
249
249
(format-table-assemble-table header body)))
250
250
251
251
(defun format-table-cleanup-and-parse (str input-mode )
0 commit comments