emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] function for inserting a block


From: Nicolas Goaziou
Subject: Re: [O] function for inserting a block
Date: Sun, 22 Oct 2017 11:54:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hello,

Eric Abrahamsen <address@hidden> writes:

> Kaushal Modi <address@hidden> 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 <pre> <code> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]