|
From: | Jean Louis |
Subject: | Re: Format of lists and alists required for displaying lists of tabulated data |
Date: | Wed, 21 Jun 2023 07:48:44 +0300 |
User-agent: | Mutt/2.2.10+64 (b470a9a) (2023-06-05) |
* uzibalqa <uzibalqa@proton.me> [2023-06-19 22:00]: > (setq foo '((a . ["aa1" "aa2"]) (b . ["bb1" "bb2"]) (c . ["cc1" "cc2"]))) > (tlprint-alist foo) > > (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) ))) It works! Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/
[Prev in Thread] | Current Thread | [Next in Thread] |