[-] sachac@lemmy.ml 2 points 3 weeks ago
[-] sachac@lemmy.ml 1 points 4 months ago

Sorry for the late reply here too, and thanks for your e-mail! You've probably already figured out that you can change the :var in the second babel block to point to a different table (ex: :var source=another_table) named with #+NAME: . The tags you've defined with #+TAGS: are file-level, but it's possible to change the function so that it can take an optional argument with a tag hierarchy, so you can make your own structure.

[-] sachac@lemmy.ml 3 points 8 months ago* (last edited 4 months ago)

Edit 2026-01-07: added the missing ) and fixed the formatting

Here's how I would approach it:

#+STARTUP: noptag
#+TAGS:
#+TAGS: [ GT1 : tagA tagC tagD ]
#+TAGS: [ GT2 : tagB tagE ]
#+TAGS: [ GT3 : tagB tagC tagD ]

#+NAME: source
| tag  | Q1 | Q2 |
|------+----+----|
| tagA |  9 |    |
| tagB |  4 |  2 |
| tagC |  1 |  4 |
| tagD |    |  5 |
| tagE |    |  6 |

#+begin_src emacs-lisp
(defun my-sum-tag-groups (source)
  (cons
   (car source)
   (mapcar
    (lambda (tag-group)
      (let ((tags (org--tags-expand-group (list (car tag-group)) org-tag-groups-alist nil)))
        (cons
         (car tag-group)
         (seq-map-indexed
          (lambda (colname i)
            (apply
             '+
             (mapcar
              (lambda (tag)
                (let ((val (or (elt (assoc-default tag source) i) "0")))
                  (if (stringp val)
                      (string-to-number val)
                    (or val 0))))
              tags)))
          (cdr (car source))))))
    org-tag-groups-alist)))
#+end_src

#+begin_src emacs-lisp :var source=source :colnames no :results table
(my-sum-tag-groups source)
#+end_src

#+RESULTS:
:results:
| tag | Q1 | Q2 |
| GT1 | 10 |  9 |
| GT2 |  4 |  8 |
| GT3 |  5 | 11 |
:end:
[-] sachac@lemmy.ml 2 points 2 years ago

There used to be one in Sao Paulo, but I think the organizer stopped paying for the meetup.com subscription. There's still a meetup page for one in Pelotas (https://www.meetup.com/Pelotas-Emacs-Meetup/) which is inactive, but maybe it can be turned into an online meetup? EmacsATX uses Google Meet; I can also set you up on BigBlueButton if you prefer something that uses free/libre software.

[-] sachac@lemmy.ml 3 points 2 years ago

Aww shucks, thanks. =) And yeah, there's always more to learn!

21
submitted 2 years ago by sachac@lemmy.ml to c/emacs@lemmy.ml

Please send in your proposal by September 14 (or earlier). Thank you!

2
submitted 4 years ago by sachac@lemmy.ml to c/emacs@lemmy.ml
3
submitted 4 years ago by sachac@lemmy.ml to c/emacs@lemmy.ml
1
submitted 4 years ago by sachac@lemmy.ml to c/emacs@lemmy.ml
8
submitted 4 years ago by sachac@lemmy.ml to c/emacs@lemmy.ml

sachac

joined 4 years ago