From mboxrd@z Thu Jan 1 00:00:00 1970 From: Severin Kempf Subject: Re: macro with inline source does not work in table cells Date: Thu, 12 Apr 2018 14:32:44 -0400 Message-ID: <873700z35f.fsf@3imail.com> References: <877epfx7at.fsf@3imail.com> <87k1teqakl.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6h2U-0003Ht-D5 for emacs-orgmode@gnu.org; Thu, 12 Apr 2018 14:33:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f6h2R-0006Lp-Ab for emacs-orgmode@gnu.org; Thu, 12 Apr 2018 14:33:42 -0400 Received: from antelope.ash.relay.mailchannels.net ([23.83.222.4]:61720) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f6h2Q-0005jO-Gw for emacs-orgmode@gnu.org; Thu, 12 Apr 2018 14:33:39 -0400 In-reply-to: <87k1teqakl.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org, kabriel@3imail.com Hi, on [2018-04-11] at 06:52:42 AM -0400, Nicolas Goaziou wrote: > inline source code is not supported in tables. You are expected to use `org-sbe'. > > Regards, Thanks for your suggestion. After some trial and error, I figured out how to do this using babel: <<< begin example org-mode file >>> #+MACRO: kw src_emacs-lisp[:exports results :results raw]{(concat "=" (upcase "$1") "=")} #+MACRO: ku =$1= #+NAME: kwt #+BEGIN_SRC emacs-lisp :var kw="keyword" (concat "=" (upcase kw) "=") #+END_SRC Try "hello {{{kw(world)}}}," but let's put it in a table [[tab:eg]] #+NAME: tab:eg #+CAPTION: Test table with "hello {{{kw(world)}}}" | Statement | Object | |---------------+-----------------| | hello | {{{kw(world)}}} | | this macro | {{{ku(works)}}} | | this function | =KIND-OF-WORKS= | #+TBLFM: @4$2='(org-sbe kwt (kw \"kind-of-works\")) <<< end >>> This is very cumbersome for my particular document, which has a large number of cells that I am working with. I could add an additional column to facilitate this, but I don't see a good way to hide that column from the exporter -- I only want the result, not the data needed to generate the result. That being said, the documentation states that macro expansion takes place, among other places, in table cells (https://orgmode.org/manual/Macro-replacement.html#Macro-replacement). When I look at ox.el, org-macro-replace-all is run prior to org-babel-exp-process-buffer, and it looks to me like org-babel-exp-process-buffer also includes inline blocks, obviously the case because this process works in the document text and in the table caption. What is preventing it from working in the table cell? What is allowing a simpler macro expansion to work inside of a table cell?