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)))
(cols (cdr (org-export-table-dimensions table info)))
(build-dummy-header
(function
(lambda ()
(let ((build-empty-cell (org-gfm-make-hline-builder table info ?\s))
(build-rule (org-gfm-make-hline-builder table info ?-))
(columns (number-sequence 0 (- cols 1))))
(concat gfm-table-left-border
(mapconcat (lambda (col) (funcall build-empty-cell col))
columns
gfm-table-separator)
gfm-table-right-border "\n" gfm-table-left-border
(mapconcat (lambda (col) (funcall build-rule col))
columns
gfm-table-separator)
gfm-table-right-border "\n"))))))
(concat (when no-header (funcall build-dummy-header))
(lambda ()
(let ((build-empty-cell (org-gfm-make-hline-builder table info ?\s))
(build-rule (org-gfm-make-hline-builder table info ?-))
(columns (number-sequence 0 (- cols 1))))
(concat gfm-table-left-border
(mapconcat (lambda (col) (funcall build-empty-cell col))
columns
gfm-table-separator)
gfm-table-right-border "\n" gfm-table-left-border
(mapconcat (lambda (col) (funcall build-rule col))
columns
gfm-table-separator)
gfm-table-right-border "\n")))))
(concat (and no-header (funcall build-dummy-header))
(replace-regexp-in-string "\n\n" "\n" contents))))
;;;; Table of contents