Re:Hypertext Emacs: You may not need org-mode
by kagevf on Tuesday January 31, 2023 @09:43PM
(#34605661)
Is there a way to render the org table without using a source block?
This is what I did:
- input the defun for create-summary in ielm
- Added tables like the ones in your link. NOTE: I used different numbers.
- M-x create-summary runs but it just echoes some messages.
- I put (create-summary) in my org doc, then ran C-u C-x C-e and it returns the lisp representation of the table:
(("Team" "Hours") hline (#("Team 1" 0 6 (face org-level-1 fontified t)) 30) (#("Team 2" 0 2 (face org-level-1 fontified t) 2 3 (face org-level-1 fontified t) 3 6 (face org-level-1 fontified t)) 60) hline ("Total" 90))
- Then, I put the lisp object in a variable in source block, eval'd it and got the table: #+BEGIN_SRC emacs-lisp
(setq x '(("Team" "Hours") hline (#("Team 1" 0 6 (face org-level-1 fontified t)) 30) (#("Team 2" 0 2 (face org-level-1 fontified t) 2 3 (face org-level-1 fontified t) 3 6 (face org-level-1 fontified t)) 60) hline ("Total" 90)))
x
#+END_SRC
#+RESULTS:
| Team | Hours |
|--------+-------|
| Team 1 | 30 |
| Team 2 | 60 |
|--------+-------|
| Total | 90 |
I was wondering if there was a way to generate the table just by running a function.Got the idea to use a source block from here: https://stackoverflow.com/questions/65950060/converting-list...
As I enter new data into the tables or edit existing data, I may want to automatically recompute aggregate data pertaining to those tables. For example, I may want to recompute the totals or averages using the data in these tables. Further, I may want to write some Elisp code in the same file that composes new tables automatically based on the data in the existing tables.
This is the kind of spreadsheet management work I use org-mode for. Here is a simple example that illustrates some of the points I made in the previous paragraph: https://github.com/susam/lab/blob/main/emacs/org/total-of-to...