I tried the example from (info "(org) Environment of a Code Block"):

#+NAME: less-cols
| a |
| b |
| c |

# I changed the value of ‘:colnames’ to _yes_.
#+BEGIN_SRC python :var tab=less-cols :colnames yes
  return [[val + '*' for val in row] for row in tab]

But the resulting table is still the same as when :colnames is nil:

| a  |
| b* |
| c* |

Am I missing something?


I’m writing my SQL notes. The resulting table contains some underlines, e.g.,

 SELECT underline_1, underline_2
 FROM MyTable;

| underline_1  | ...
|     xx_x     | ...
|     yy_y     | ...

An underline will be interpreted as the beginning of a subscript. So I want to replace them with \unders, thus tried the following code:

#+NAME: underline-escaper
#+BEGIN_SRC emacs-lisp  :var resulting-table='(("_"))  :colnames yes
  (mapcar (lambda (cell)
            `(,(string-replace "_" "\\under" (car cell))))

#+BEGIN_SRC sql  :post underline-escaper(*this*)
 SELECT 'underline_1' AS "underline_1";

|   underline_1    |
| underline\under1 |

But the column name is still “underline_1”.

  • 1
    Maybe worth to report it via M-x report-emacs-bug? Commented Dec 11, 2023 at 15:42
  • @ManuelUberti : Thanks for your suggestion. But I'm not sure; it might not be a bug, but rather a misunderstanding of the document on my part (I've only been using Org Babel for less than half a month).
    – shynur
    Commented Dec 11, 2023 at 15:49
  • Not a bug (it is documented on the above page), but confusing nevertheless: the opposite of yes is no, not nil. nil and yes are more-or-less equivalent: they are exactly equivalent if there is an hline in the second row; they differ a bit if there isn't such an hline.
    – NickD
    Commented Dec 11, 2023 at 16:42
  • Actually, there may be a bug: nil and yes seem exactly equivalent experimentally; so it may be that the doc is wrong.
    – NickD
    Commented Dec 11, 2023 at 16:45


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.