From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [RFC] Sloppy `org-element-context'? Date: Thu, 27 Mar 2014 22:34:14 +0100 Message-ID: <87r45njpgp.fsf@pank.eu> References: <874n2jsls9.fsf@gmail.com> 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]:51306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTHub-00070c-L2 for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 17:32:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTHuU-0002wY-CI for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 17:32:33 -0400 Received: from plane.gmane.org ([80.91.229.3]:56586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTHuU-0002wS-6A for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 17:32:26 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WTHuT-0000Uv-2s for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 22:32:25 +0100 Received: from dynamic-adsl-94-39-218-180.clienti.tiscali.it ([94.39.218.180]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 27 Mar 2014 22:32:25 +0100 Received: from rasmus by dynamic-adsl-94-39-218-180.clienti.tiscali.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 27 Mar 2014 22:32:25 +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 Goaziou writes: > As you may know, `org-element-context' returns the object under point, > according to Org Syntax. The questions are: should it be a little > sloppy, for convenience? And, if it should, what degree of sloppiness is > acceptable? Would it make sense to make it optional? For my personal hacks, I much prefer to work with an element, if possible, and flexibility could facility fast and easy hacks. On the other hand in Org-core clarity and strictness is (probably) preferable. So something like this (let (org-element-strict) (FUN (org-element-context) ...)). > Note that, at the time being, the function is already somewhat sloppy, > because it will return an object right before point. In the following > example, "|" is point. Even though it is not on the bold object, > evaluating (org-element-context) there will give: > > "*bold*| text" => (bold ...) > Should we go further? A recent discussion about opening links in node > properties suggests that some users expect to encounter Org syntax > there. I believe this is not generally desirable. I haven't seen this discussion. I looked briefly at the suggested patch; I don't understand why it would be necessary or desirable. But I will not rule out that I have yet to consider the correct case! > Anyway, here we are. I think it is important to define clearly what > belongs to the syntax (I think it is quite good at the moment), what can > be allowed for the sake of convenience, and what line should never be > crossed (I firmly believe, for example, that `org-element-context' > should never return objects in a comment, an example block, or > a fixed-width area). As a user I have no problems with the syntax. As a hacker (not quite a developer!), I do at time desire more flexibility with org-context to temporarily evaluating an element under alternative assumptions of its properties. A recent example evaluate $x^{z}$ as-if it isn't a latex-fragment. —Rasmus -- This space is left intentionally blank