From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Huszagh Subject: babel comma escape with :wrap Date: Fri, 07 Feb 2020 23:42:25 -0800 Message-ID: <87imkhikym.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:44491) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0Kl8-0001Lf-G4 for emacs-orgmode@gnu.org; Sat, 08 Feb 2020 02:42:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j0Kl7-0003Sj-GR for emacs-orgmode@gnu.org; Sat, 08 Feb 2020 02:42:34 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:45864) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j0Kl7-0003SV-98 for emacs-orgmode@gnu.org; Sat, 08 Feb 2020 02:42:33 -0500 Received: by mail-pf1-x42a.google.com with SMTP id 2so937047pfg.12 for ; Fri, 07 Feb 2020 23:42:33 -0800 (PST) Received: from ryzen3950 (c-98-210-127-71.hsd1.ca.comcast.net. [98.210.127.71]) by smtp.gmail.com with ESMTPSA id m128sm5256727pfm.183.2020.02.07.23.42.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 23:42:30 -0800 (PST) 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: "emacs-orgmode@gnu.org" There appears to be no way to disable the comma escape when using :wrap for a babel source block. I'm essentially trying to replicate this example from the manual #+NAME: attr_wrap #+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output echo "#+ATTR_LATEX: :width $width" echo "$data" #+END_SRC #+HEADER: :file /tmp/it.png #+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer digraph{ a -> b; b -> c; c -> a; } #+end_src #+RESULTS: :RESULTS: #+ATTR_LATEX :width 5cm [[file:/tmp/it.png]] :END: But, my result type is a link not a drawer (which are mutually exclusive). So, to get the same wrapping effect, I need to use the :wrap argument. However, the comma escape negates attr_wrap's effect with this code (let ((wrap (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (when inline (setq start inline-start) (setq finish inline-finish) (setq no-newlines t)) (let ((before-finish (copy-marker end))) (goto-char end) (insert (concat finish (unless no-newlines "\n"))) (goto-char beg) (insert (concat start (unless no-newlines "\n"))) (unless no-escape (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end)))) [...] But, since this file uses lexical binding (as it should) there appears to be no way to set no-escape. I searched through the changelog a bit and that seems to be a relic from an old version. At the very least, that no-escape conditional should be made unconditional. However, I do think there should be a way to avoid the comma escape, but I'm not sure of the best way to do it. I'm more than happy to write the code, but I'm curious what people think would be the best way to do it. Maybe :wrap could take a special keyword argument (e.g. no-escape) that would stop the effect. Thoughts? Best, Matt