From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: function for inserting a block Date: Sun, 22 Oct 2017 11:54:57 +0200 Message-ID: <87376btslq.fsf@nicolasgoaziou.fr> References: <877exghblx.fsf@ericabrahamsen.net> <87bmml2fb0.fsf@ericabrahamsen.net> <87fubuzpsa.fsf@nicolasgoaziou.fr> <874lsabdop.fsf@ericabrahamsen.net> <87vak1l11m.fsf@nicolasgoaziou.fr> <87r2uoc4q7.fsf@ericabrahamsen.net> <87bmllk5xy.fsf@nicolasgoaziou.fr> <878tgmwwsa.fsf@ericabrahamsen.net> <87po9q2e8k.fsf@nicolasgoaziou.fr> <87tvyyvpst.fsf@ericabrahamsen.net> <87fuaiz069.fsf@nicolasgoaziou.fr> <87lgk9eo4d.fsf@ericabrahamsen.net> <87fuahxxvs.fsf@nicolasgoaziou.fr> <87r2u1cuwj.fsf@ericabrahamsen.net> <87infdctzq.fsf@ericabrahamsen.net> <87k1zsbizs.fsf@ericabrahamsen.net> <87k1zp4rxj.fsf@ericabrahamsen.net> <871slx4j6p.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e6CyF-000375-8z for emacs-orgmode@gnu.org; Sun, 22 Oct 2017 05:55:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e6CyE-0002Hu-HW for emacs-orgmode@gnu.org; Sun, 22 Oct 2017 05:55:03 -0400 Received: from relay2-d.mail.gandi.net ([2001:4b98:c:538::194]:54286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e6CyE-0002HM-B2 for emacs-orgmode@gnu.org; Sun, 22 Oct 2017 05:55:02 -0400 In-Reply-To: <871slx4j6p.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Fri, 20 Oct 2017 14:13:02 -0700") 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: Eric Abrahamsen Cc: emacs-orgmode@gnu.org Hello, Eric Abrahamsen writes: > Kaushal Modi writes: >> I just tried it out, and it works great! >> >> I have a comment about >> >> (when (string-equal (downcase type) "example") >> (org-escape-code-in-region s e)) >> >> I have never needed to escape org in example, blocks, but I *have* needed to do that in org src blocks. >> >> Should type string be also matched with "src org"? >> >> Actually should the type string be matched only with "src org"? Because I see the Org example blocks as
  blocks in HTML with no syntax highlighting.. so
>> those can contain code from any language.
>>
>> Also as this is part of org and emacs, org-structure-predefined-blocks deserves "SRC org" and "SRC emacs-lisp" too? :)
>
> The template really only inserts the block type, not anything specific
> like the source language or export backend. I think prompting for
> "second-level" information like that might be a little overkill.
>
> As for what should be escaped and what shouldn't, I defer to Nicolas,
> let's see what he says.

"src" (not only with "org" language), "example" and "export", i.e.,
verbatim, blocks need to be escaped.

You should probably use something like

  (when (string-prefix-p (regexp-opt '("example" "export" "src")) type t)
   ...)

Regards,

-- 
Nicolas Goaziou