emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-element-at-point and special blocks


From: Rasmus
Subject: Re: [O] org-element-at-point and special blocks
Date: Thu, 10 Dec 2015 16:48:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Hi Nicolas,

Thanks for the helpful reply.

Nicolas Goaziou <address@hidden> writes:

>> Is there a reason why org-element-at-point reports the type to be a
>> paragraph for special blocks?  E.g. in the examples at the bottom of this
>> mail, where | is the cursor, the types are: export-block, src-block and
>> paragraph with a nested special block.
>
> This is a corner-case. `org-element-at-point' returns the closest
> element at point, but prefers to see an empty paragraph than a special
> block, for consistency. I.e., when point is within block boundaries, you
> never return `special-block'.

Out of curiosity, why is it "more" consistent to return paragraph here?

>> Is there a neat way to detect if point is inside a block?  I’m trying to
>> write a function for structures (e.g. #+begin_latex) that works like
>> org-babel-demarcate-block.
>
> (org-element-lineage (org-element-at-point) '(special-block) t)

That's very cool.  Thanks.

Rasmus

-- 
Even a three-legged dog has three good legs to lose




reply via email to

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