From: uzibalqa <uzibalqa@proton.me>
To: Jean Louis <bugs@gnu.support>
Cc: Bruno Barbier <brubar.cs@gmail.com>,
uzibalqa via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: Format of lists and alists required for displaying lists of tabulated data
Date: Sun, 18 Jun 2023 19:11:39 +0000 [thread overview]
Message-ID: <7_L02g1pE5Msh1pfX2YZaLJoqABrEPFtSBshQlEr7MEdToTrggvBX_QlaNpt0NWZZHtcvesFVfyCM4WTGB0vs-56Tni1wzzLx4b6T2JiffI=@proton.me> (raw)
In-Reply-To: <ZI8jPmMvJTYPZxvg@lco.syogm.com>
------- Original Message -------
On Monday, June 19th, 2023 at 3:31 AM, Jean Louis <bugs@gnu.support> wrote:
> * uzibalqa uzibalqa@proton.me [2023-06-17 16:28]:
>
> > It would also be handy to have some conversion functions that takes a normal
> > list or alist, and converts them to ones suitable for tabulated-list-entries.
>
>
> Those functions would be too much specific, and you can do those functions.
>
> I have functions like these which are using SQL which get expanded into tabulated-list-mode:
>
> (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 ?
> Or like this: (cf-people-by-id-list (list introducer)) which would show tabulated-list-format by list of people IDs
>
> My SQL has always ID followed by values, so here is the key function that converts it:
>
> (defun rcd-db-sql-report (title sql format table sort-key refresh &optional 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))))))
>
> (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.
>
> 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) table))
> (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))))
>
> The above workflow shall serve only as example to your own functions.
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/
next prev parent reply other threads:[~2023-06-18 19:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 21:08 Format of lists and alists required for displaying lists of tabulated data uzibalqa
2023-06-17 7:36 ` Bruno Barbier
2023-06-17 12:33 ` uzibalqa
2023-06-17 20:54 ` Tim Landscheidt
2023-06-18 10:36 ` uzibalqa
2023-06-18 11:29 ` Tim Landscheidt
2023-06-18 13:20 ` uzibalqa
2023-06-18 13:37 ` uzibalqa
2023-06-18 13:51 ` uzibalqa
2023-06-18 15:31 ` Jean Louis
2023-06-18 19:11 ` uzibalqa [this message]
2023-06-19 18:46 ` Jean Louis
2023-06-18 19:16 ` Christopher Dimech
2023-06-19 18:49 ` Jean Louis
2023-06-19 18:59 ` uzibalqa
2023-06-21 4:48 ` Jean Louis
2023-06-21 10:45 ` uzibalqa
2023-06-24 19:19 ` Jean Louis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='7_L02g1pE5Msh1pfX2YZaLJoqABrEPFtSBshQlEr7MEdToTrggvBX_QlaNpt0NWZZHtcvesFVfyCM4WTGB0vs-56Tni1wzzLx4b6T2JiffI=@proton.me' \
--to=uzibalqa@proton.me \
--cc=brubar.cs@gmail.com \
--cc=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.