help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Elisp Reference Manual on inserting tables


From: Heime
Subject: Re: Elisp Reference Manual on inserting tables
Date: Mon, 07 Nov 2022 07:32:35 +0000

------- Original Message -------
On Sunday, November 6th, 2022 at 8:48 PM, Michael Heerdegen 
<michael_heerdegen@web.de> wrote:


> Heime heimeborgia@protonmail.com writes:
> 
> > As I was talking about making tables from elisp, I though there should
> > be something in the Elisp Manual as well. Or perhaps in the Elisp
> > Tutorial?
> 
> 
> Emacs doesn't have a simple function to format simple text tables
> built-in (so there is nothing to document). I wrote my own one some
> time ago, maybe it is of help:

I have the following function that makes a list of lists, with one list
constituting a row.

(defun pmchart (descr rekr)
  "Makes a tabel structure."
  (mapcar
   (lambda (n)
     (append (make-list n "xxxxx")
             (make-list (- 3 n) "")))
   rekr))

The call

(pmchart '("A" "B" "C" "D" "E") [3 2 2 1 0])

produces

'(("xxxxx" "xxxxx" "xxxxx")
  ("xxxxx" "xxxxx" "")
  ("xxxxx" "xxxxx" "")
  ("xxxxx" "" "")
  ("" "" "")))

I would like to adapt it to produce 

'(("A" "xxxxx" "xxxxx" "xxxxx")
  ("B" "xxxxx" "xxxxx" "")
  ("C" "xxxxx" "xxxxx" "")
  ("D" "xxxxx" "" "")
  ("E" "" "" "")))







reply via email to

[Prev in Thread] Current Thread [Next in Thread]