Skip to content

Commit 66f854f

Browse files
author
Jason Duncan
committed
I'm told this is good practice.
1 parent 1357c98 commit 66f854f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

format-table.el

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@
122122
(separator-end-row (plist-get input-mode :separator-end-row))
123123
(separator-col-separator (plist-get input-mode :separator-col-separator))
124124
(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)))))
127127

128128
(defun format-table-split-row (row col-widths input-mode)
129129
"Split the given string ROW based on the fixed positions listed in COL-WIDTHS and any additional information in INPUT-MODE."
@@ -163,15 +163,15 @@
163163
(let ((last (make-list (length (car table)) 0)))
164164
(dolist (cur-row table last)
165165
(setq last
166-
(-zip-with 'max (-map 'length cur-row) last)))))
166+
(-zip-with #'max (-map #'length cur-row) last)))))
167167

168168
(defun format-table-render-row (row max-col-widths output-mode &optional pad-fn)
169169
"Render a table row with the proper column separators and a newline.
170170
171171
Arguments are the list of values ROW, the list of MAX-COL-WIDTHS, and delimiter
172172
information in OUTPUT-MODE. Optionally use PAD-FN to pad each column value,
173173
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)))
175175
(concat
176176
(plist-get output-mode :begin-row)
177177
(string-join
@@ -188,7 +188,7 @@ otherwise values will be padded to the right with spaces."
188188
"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."
189189
(concat (plist-get output-mode :separator-begin-row)
190190
(string-join
191-
(-map 'format-table-generate-dash-string max-col-widths)
191+
(-map #'format-table-generate-dash-string max-col-widths)
192192
(plist-get output-mode :separator-col-separator))
193193
(plist-get output-mode :separator-end-row)
194194
hard-newline))
@@ -197,7 +197,7 @@ otherwise values will be padded to the right with spaces."
197197
"Render the TABLE of values as a json string."
198198
(let ((vec []))
199199
(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)))
201201
(setq vec (vconcat vec (list rec)))))
202202
(json-encode vec)))
203203

@@ -234,18 +234,18 @@ otherwise values will be padded to the right with spaces."
234234

235235
(defun format-table-parse-json-gather-column-values (obj)
236236
"Gather cdrs from alist OBJ."
237-
(-map 'cdr obj))
237+
(-map #'cdr obj))
238238

239239
(defun format-table-parse-json-gather-column-names (obj)
240240
"Gather cars from alist OBJ."
241-
(-map 'car obj))
241+
(-map #'car obj))
242242

243243
(defun format-table-parse-json (str)
244244
"Parse the json string STR to a table of values as a plist."
245245
(let* ((json-key-type 'string)
246246
(vec (append (json-read-from-string str) nil))
247247
(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)))
249249
(format-table-assemble-table header body)))
250250

251251
(defun format-table-cleanup-and-parse (str input-mode)

0 commit comments

Comments
 (0)