From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Format of lists and alists required for displaying lists of tabulated data Date: Wed, 21 Jun 2023 07:48:44 +0300 Message-ID: References: <648d6296.050a0220.f0b55.8bfc@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3441"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.2.10+64 (b470a9a) (2023-06-05) Cc: Christopher Dimech , Bruno Barbier , uzibalqa via Users list for the GNU Emacs text editor To: uzibalqa Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 21 11:54:37 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBuXs-0000hE-SN for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 21 Jun 2023 11:54:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBuXJ-0000cD-Jc; Wed, 21 Jun 2023 05:54:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBuXH-0000bd-QX for help-gnu-emacs@gnu.org; Wed, 21 Jun 2023 05:53:59 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBuXF-0005YW-Sw for help-gnu-emacs@gnu.org; Wed, 21 Jun 2023 05:53:59 -0400 Original-Received: from localhost ([::ffff:41.75.170.84]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 0000000000055D69.000000006492C893.00006BC3; Wed, 21 Jun 2023 02:53:22 -0700 Mail-Followup-To: uzibalqa , Christopher Dimech , Bruno Barbier , uzibalqa via Users list for the GNU Emacs text editor Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:144011 Archived-At: * uzibalqa [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/