Hello fellow Org-mode users,

I have developed a sufficiently large bump on my forehead from banging repeated 
against the wall and wonder if another pair of eyes (perhaps connected to a 
more capable brain) might shed light on this conundrum.

I’m working on some literate DevOps where I need to list systemd units on an 
Arch Linux box and have a list of novel services we want to inspect. I teed up 
a named list and source block with a for loop, a call to systemctl and a bit of 
awk to parse things into a tab-separated list for Org to generate a table.

The odd thing was I’d lose the first two rows every time I used :colnames with 
my source block. I’ve managed to reproduce the issue down to this minimal 
snippet:

#+name: list
- a
- b
- c

#+begin_src sh :var list=list :results output table :colnames '("Key" "Value")
for item in $list; do
  echo -e "$item\t$item"
done
#+end_src

#+results:
| Key | Value |
|-----+-------|
| c   | c     |


Why does Org-mode only return a single row of Cs? What happened to the A and B 
rows?

This works as expected:

#+begin_src sh :results output table :colnames '("Key" "Value")
for item in a b c; do
  echo -e "$item\t$item"
done
#+end_src

#+results:
| Key | Value |
|-----+-------|
| a   | a     |
| b   | b     |
| c   | c     |

I’ve run into issues with for loops inside source blocks combined with pipes 
and executables that swallow stdin in the past, but this seems too simple to be 
misbehaving.

I hope it’s not some advice I’ve long ago added to my Emacs config. Has anyone 
else noticed similar with Emacs 30.1 and Org-mode 9.7.34?

GNU Emacs 30.1 (build 1, aarch64-apple-darwin24.6.0, NS appkit-2575.70 Version 
15.6 (Build 24G84))
Org mode version 9.7.34 (9.7.34-??-8b15a0d0b @ 
/Users/jcf/.config/emacs/.local/straight/build-30.1/org/
https://github.com/doomemacs/doomemacs/commit/26a5ad72e161f53151e78580a62bcd0757a7bf40

And if anyone has any recommendations for a non-drowsy analgesic…

All the best,

-- 
James Conroy-Finn
www.invetica.co.uk

Reply via email to