From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Context of interaction vs. literal syntactic interpretation (was: link interfering with brackets when abbreviated) Date: Mon, 03 Mar 2014 10:50:57 +0100 Message-ID: <87siqzhapq.fsf@bzg.ath.cx> References: <87lhwxswby.fsf@gmail.com> <87ha7lsu5o.fsf@gmail.com> <8761o1n63t.fsf@bzg.ath.cx> <8738j5snms.fsf@gmail.com> <87vbw11o3q.fsf@bzg.ath.cx> <87ppm8rgrf.fsf@gmail.com> <87lhwwgqe4.fsf@bzg.ath.cx> <878uswqfzc.fsf@gmail.com> <87zjl9vjw4.wl@dns1.atmark-techno.com> <87ha7hpt6l.fsf@gmail.com> <87wqgdv48n.wl@dns1.atmark-techno.com> <87mwh9nf6h.fsf@gmail.com> <87wqgcka56.fsf@bzg.ath.cx> <87y50sn09o.fsf@gmail.com> <878ussk3c7.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKPWg-0005EO-QX for emacs-orgmode@gnu.org; Mon, 03 Mar 2014 04:51:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKPWa-0003pU-Jn for emacs-orgmode@gnu.org; Mon, 03 Mar 2014 04:51:10 -0500 Received: from rs249.mailgun.us ([209.61.151.249]:43462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKPWa-0003pK-At for emacs-orgmode@gnu.org; Mon, 03 Mar 2014 04:51:04 -0500 In-Reply-To: (Michael Brand's message of "Mon, 3 Mar 2014 06:54:29 +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: Michael Brand Cc: Org Mode , Nicolas Goaziou Hi Gustav, Josiah and Michael, thanks *a lot* for your feedback, it triggered an idea I want to turn into a proposal. I changed the subject of this thread to better frame the issue at stake, and explain my proposal. Emacs commands depend on their context: this is the modal approach we love. For example, M-; will behave differently whether we are in an org-mode buffer or in a html-mode buffer. The context of interaction is the relevant syntactic environment that Emacs needs to know about when a command is called. By essence, a parser is very strict about the inclusion model of syntactic elements: e.g., a tag cannot be part of a paragraph, a TODO keyword cannot be part of a timestamp, a timestamp cannot be part of a property value, a link cannot be part of a comment, etc. This is *good* to have such a strict parser and it must be as strict and consistent as possible -- we all agree on that. For most commands, the first literal syntactic interpretation is the only relevant context of interaction: e.g., it would not make sense to try updating a tag outside of a headline (i.e. outside of where a tag is a tag, from the parser's view.) For some commands, another higher context can also be relevant: e.g., when the point is on a heading and the user hit C-c C-o, Org needs to know whether we are on a link (in this case it will open the link). If not, it checks for a higher context: when we are on a heading, it will look for multiple links and prompt the user for which one to open. (A generalization of this "links-in-a-heading" behavior for something like "links-in-a-paragraph", as suggested by Gustav, is a good idea.) For handling comments, my suggestion is this to let the user decide if she wants to activate C-c C-o in comments by temporarily considering the contents of a comment as a paragraph. Something like (let ((comment-contents (org-element-property :value (org-element-context)))) (with-temp-buffer (insert comment-contents) (org-open-at-point))) provided we preserve the relative point position. (Another route is to change the syntactic meaning of comments: they could contain paragraphs and be contained within subtrees.) Note that this suggestion does not deviate from what we already do: see the example of C-c C-o checking for a higher context when hit in headlines. So while I suggest a change for handling links in paragraphs (I do support Gustav suggestion) and in comments (see the proposal above), I don't suggest a change in the role the parser has: I only describe a frame in which what seems inconsistent is not anymore. For example, it may seem inconsistent to allow using S- to update a timestamp in a property drawer, since property drawers don't allow timestamps. But it is not inconsistent if S- is allowed to refer to a higher context (the subtree's content instead of the property drawer.) For sure, such flexibility should be the exception, not the norm, but considering it is very important in terms of user experience IMO. I hope this is clear enough and can help us moving forward. Thanks, -- Bastien