From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: org-element-at-point and special blocks Date: Thu, 10 Dec 2015 16:48:41 +0100 Message-ID: <87fuzajodi.fsf@gmx.us> References: <87y4d3jy6t.fsf@gmx.us> <87zixiolps.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a73Tv-00038i-4g for emacs-orgmode@gnu.org; Thu, 10 Dec 2015 10:50:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a73Ts-0004ZC-0L for emacs-orgmode@gnu.org; Thu, 10 Dec 2015 10:50:11 -0500 Received: from plane.gmane.org ([80.91.229.3]:55766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a73Tr-0004Yv-R0 for emacs-orgmode@gnu.org; Thu, 10 Dec 2015 10:50:07 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a73Tn-0001CC-OC for emacs-orgmode@gnu.org; Thu, 10 Dec 2015 16:50:03 +0100 Received: from 62.80.108.45 ([62.80.108.45]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Dec 2015 16:50:03 +0100 Received: from rasmus by 62.80.108.45 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Dec 2015 16:50:03 +0100 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Nicolas, Thanks for the helpful reply. Nicolas Goaziou 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