org-gfm-table: Cosmetics

- It is redundant to use `function' around `lambda'.
- It is semantically better to use `and' if the returned value
  matters.  `when' should be used if we only care about the
  side-effects.
This commit is contained in:
Jonas Bernoulli 2023-07-19 02:32:46 +02:00
parent 4aabaa51b1
commit a971997f8f

View File

@ -206,21 +206,20 @@ contextual information."
(no-header (or (<= (length rows) 1))) (no-header (or (<= (length rows) 1)))
(cols (cdr (org-export-table-dimensions table info))) (cols (cdr (org-export-table-dimensions table info)))
(build-dummy-header (build-dummy-header
(function (lambda ()
(lambda () (let ((build-empty-cell (org-gfm-make-hline-builder table info ?\s))
(let ((build-empty-cell (org-gfm-make-hline-builder table info ?\s)) (build-rule (org-gfm-make-hline-builder table info ?-))
(build-rule (org-gfm-make-hline-builder table info ?-)) (columns (number-sequence 0 (- cols 1))))
(columns (number-sequence 0 (- cols 1)))) (concat gfm-table-left-border
(concat gfm-table-left-border (mapconcat (lambda (col) (funcall build-empty-cell col))
(mapconcat (lambda (col) (funcall build-empty-cell col)) columns
columns gfm-table-separator)
gfm-table-separator) gfm-table-right-border "\n" gfm-table-left-border
gfm-table-right-border "\n" gfm-table-left-border (mapconcat (lambda (col) (funcall build-rule col))
(mapconcat (lambda (col) (funcall build-rule col)) columns
columns gfm-table-separator)
gfm-table-separator) gfm-table-right-border "\n")))))
gfm-table-right-border "\n")))))) (concat (and no-header (funcall build-dummy-header))
(concat (when no-header (funcall build-dummy-header))
(replace-regexp-in-string "\n\n" "\n" contents)))) (replace-regexp-in-string "\n\n" "\n" contents))))
;;;; Table of contents ;;;; Table of contents