Tidy: (org-dblock-write:org-ql)

This commit is contained in:
Adam Porter 2020-11-10 04:24:38 -06:00
parent 2e469fa547
commit 0cfe44084b

View file

@ -273,11 +273,11 @@ For example, an org-ql dynamic block header could look like:
(format-fns (format-fns
;; NOTE: Backquoting this alist prevents the lambdas from seeing ;; NOTE: Backquoting this alist prevents the lambdas from seeing
;; the variable `ts-format', so we use `list' and `cons'. ;; the variable `ts-format', so we use `list' and `cons'.
(list (cons 'heading (lambda (element) (list (cons 'todo (lambda (element)
(org-element-property :todo-keyword element)))
(cons 'heading (lambda (element)
(org-make-link-string (org-element-property :raw-value element) (org-make-link-string (org-element-property :raw-value element)
(org-element-property :raw-value element)))) (org-element-property :raw-value element))))
(cons 'todo (lambda (element)
(org-element-property :todo-keyword element)))
(cons 'priority (lambda (element) (cons 'priority (lambda (element)
(--when-let (org-element-property :priority element) (--when-let (org-element-property :priority element)
(char-to-string it)))) (char-to-string it))))
@ -302,19 +302,16 @@ For example, an org-ql dynamic block header could look like:
(list (alist-get (car column) format-fns))) (list (alist-get (car column) format-fns)))
collect (or (funcall fn element) "")) collect (or (funcall fn element) ""))
" | "))) " | ")))
;; Insert table header. ;; Table header
(insert "| " (string-join (--map (pcase it (insert "| " (string-join (--map (pcase it
((pred symbolp) (capitalize (symbol-name it))) ((pred symbolp) (capitalize (symbol-name it)))
(`(,_ ,name) name)) (`(,_ ,name) name))
columns) columns)
" | ") " | ")
" |" "\n") " |" "\n")
;; Separator line. (insert "|- \n") ; Separator hline
(insert "|- \n")
;; Elements.
(dolist (element elements) (dolist (element elements)
(insert "| " (format-element element) " |" "\n")) (insert "| " (format-element element) " |" "\n"))
;; Delete final newline and align table.
(delete-char -1) (delete-char -1)
(org-table-align)))) (org-table-align))))