Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 15521

Printing arbitrary number of columns with tabulated-list-print

$
0
0

I have the following function that displays a table in a buffer.

But this handles only two columns. How can I extend this to handlean arbitrary number of columns?

(defun tlprint-alist (alist &optional outbufr keytl valtl)"Print an associated list via `tabulated-list-print'."  (let*      ( (bufr (or outbufr (get-buffer-create "*Alist2*")))        (keytl (or keytl "Key Title"))        (valtl (or valtl "Value Title")) )    (with-current-buffer bufr      (tabulated-list-mode)      (setq buffer-read-only nil)      (setq tabulated-list-format             (vector (list keytl 20 t) (list valtl 20 t)))      (setq tabulated-list-sort-key (cons keytl nil))      (setq tabulated-list-entries            (mapcar (lambda (dyad)                      (list (car dyad) (cdr dyad)))                    alist))      (tabulated-list-init-header)      (tabulated-list-print) )))

Viewing all articles
Browse latest Browse all 15521

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>