From 03277714baa1b4c298d66b4b9f1031f6d17e55c2 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Mon, 12 May 2025 00:04:24 -0400 Subject: [PATCH] partial implementation of pt-get-columns --- pivot-table.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pivot-table.el b/pivot-table.el index af66e58..d10d5bb 100644 --- a/pivot-table.el +++ b/pivot-table.el @@ -40,6 +40,18 @@ TODO: more documentation" (dolist (record src-body) (pt--process-record record source-cols buckets)))) +(defun pt-get-columns (source) + "Extract the column names from a table" + (let (result) + (dolist (row source) + (unless (and (listp row) (eq "!" (car row))) + (let ((n 2)) + (dolist (cell (cdr row)) + (unless (eq cell "") + (setq result (((format "%s" cell) . n) . result))) + (setq n (1+ n)))))) + result)) + ;; Local Variables: ;; read-symbol-shorthands: (("pt-" . "pivot-table-")) ;; End: