From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: uzibalqa Newsgroups: gmane.emacs.help Subject: Re: Format of lists and alists required for displaying lists of tabulated data Date: Sun, 18 Jun 2023 19:11:39 +0000 Message-ID: <7_L02g1pE5Msh1pfX2YZaLJoqABrEPFtSBshQlEr7MEdToTrggvBX_QlaNpt0NWZZHtcvesFVfyCM4WTGB0vs-56Tni1wzzLx4b6T2JiffI=@proton.me> References: <648d6296.050a0220.f0b55.8bfc@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9545"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Bruno Barbier , uzibalqa via Users list for the GNU Emacs text editor To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 18 21:12:13 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 1qAxop-0002Gk-P2 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 18 Jun 2023 21:12:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAxoX-0005ga-MG; Sun, 18 Jun 2023 15:11:53 -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 1qAxoW-0005cx-3f for help-gnu-emacs@gnu.org; Sun, 18 Jun 2023 15:11:52 -0400 Original-Received: from mail-4325.protonmail.ch ([185.70.43.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAxoS-0002BD-7T for help-gnu-emacs@gnu.org; Sun, 18 Jun 2023 15:11:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=3wff3miojbgpjixozbm6n2xjxm.protonmail; t=1687115505; x=1687374705; bh=baTNVWUr4PxPwTV2aoSOZv0k+co2iuXlLmu6wRziQvo=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=WykxWMrb2hBbEgBPd2797FzjrTaB282aDMw2vaPIojKb0byYRuYKBnWgABh5nhin+ 6MKUTM/e6KyCTC6ehtq+Y5AmV/5Gvn53eHjjbmGkJMqd7qEQOV66d5hiP7NyaWk7zu FnsYAIsvOKGz3WnZj1IEfBGbVhh+qHAsARK+JC7RH/IoUJzWBfpwtrx5qTmDnVxAYn QUhWKulazYdvJTcFZ3xSj8SBeboIM7C3qqMTuSoD4EJwKjE1g/NVruaLmnGMBmqwoz e/iVxp4X4YaDDaLY/TMRzX+dKahyLJi1gJoGQw2186lXlAhGhMxhDupc/ssJnHeUGC 5PSFG0Dv6kF8Q== In-Reply-To: Feedback-ID: 52887082:user:proton Received-SPF: pass client-ip=185.70.43.25; envelope-from=uzibalqa@proton.me; helo=mail-4325.protonmail.ch X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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:143993 Archived-At: ------- Original Message ------- On Monday, June 19th, 2023 at 3:31 AM, Jean Louis wrote: > * uzibalqa uzibalqa@proton.me [2023-06-17 16:28]: >=20 > > It would also be handy to have some conversion functions that takes a n= ormal > > list or alist, and converts them to ones suitable for tabulated-list-en= tries. >=20 >=20 > Those functions would be too much specific, and you can do those function= s. >=20 > I have functions like these which are using SQL which get expanded into t= abulated-list-mode: >=20 > (rcd-db-sql-report title sql cf-people-tabulated-format-with-people-list = "people" nil refresh-function '(">>>UNKNOWN<<<") return-function) Are your tools designed for possibility of having multiple columns ? =20 =20 > Or like this: (cf-people-by-id-list (list introducer)) which would show t= abulated-list-format by list of people IDs >=20 > My SQL has always ID followed by values, so here is the key function that= converts it: >=20 > (defun rcd-db-sql-report (title sql format table sort-key refresh &option= al highlight-list return-function) > "Prepare SQL for tabulated list report." > (let* ((entries-1 (rcd-sql sql cf-db)) > (entries-2 > (mapcar #'(lambda (i) > (list > (elt i 0) > (vconcat > (append (list > (cond ((numberp (elt i 0)) (number-to-string (elt i 0))) > (t (elt i 0)))) > (cdr (append i nil)))))) > entries-1))) > (cond (entries-1 (rcd-db-report title entries-2 format "pg" 'cf-db table = sort-key refresh highlight-list nil nil return-function)) > (t (rcd-warning-message (format "No entries for report `%s'" title)))))) >=20 > (defun rcd-db-report (title entries format database-type db-handle table = sort-key > &optional refresh highlight-list place id return-function) > "RCD database report. >=20 > TITLE is buffer name." > (setq rcd-db-current-database-type database-type) > (let* ((buffer (generate-new-buffer-name (rcd-notes-name title)))) > (let* ((buffer (get-buffer-create buffer)) > (mode-map (rcd-db-table-mode-map table))) > (cond ((string-equal table "edit") (switch-to-buffer buffer)) > (rcd-dont-switch-windows (switch-to-buffer buffer)) > (t (switch-to-buffer-other-window buffer))) > (setq tabulated-list-format format) > (setq tabulated-list-entries entries) > (setq rcd-db-edited-table table) > (setq rcd-db-current-database-type database-type) > (setq rcd-tabulated-refresh-function refresh) > (setq rcd-current-return-function return-function) > (rcd-db-list-mode) > (use-local-map mode-map) > (setq rcd-tabulated-marked-items nil) > (setq rcd-db-current-database-handle db-handle) > (setq rcd-db-current-table (or (alist-get "table" place nil nil 'equal) t= able)) > (setq rcd-db-current-table-id id) > (setq tabulated-list-padding 1) > (tabulated-list-init-header)) > (setq tabulated-list-sort-key sort-key) > (tabulated-list-print t) > (when highlight-list > (rcd-highlight-list highlight-list)))) >=20 > The above workflow shall serve only as example to your own functions. >=20 > -- > Jean >=20 > Take action in Free Software Foundation campaigns: > https://www.fsf.org/campaigns >=20 > In support of Richard M. Stallman > https://stallmansupport.org/