[Top][All Lists]

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

Re: [O] function for inserting a block

From: Eric Abrahamsen
Subject: Re: [O] function for inserting a block
Date: Sun, 22 Oct 2017 10:49:36 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

> 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)
>    ...)

string-prefix-p doesn't appear to work with regular expressions, so I
used string-match-p.

Attachment: 0001-New-function-org-insert-structure-template.patch
Description: Text Data

reply via email to

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