From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: [RFC] Org Minor Mode? Date: Sun, 13 Apr 2014 18:28:22 +0200 Message-ID: <8761mdw5w9.fsf@gmail.com> References: <87ha61f4rk.fsf@gmail.com> <8738hlkn64.fsf@gmail.com> <87k3aw0zmx.fsf@bzg.ath.cx> <87lhvbeq7o.fsf@berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZNFU-0008CO-M5 for emacs-orgmode@gnu.org; Sun, 13 Apr 2014 12:27:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WZNFP-0001Ks-N6 for emacs-orgmode@gnu.org; Sun, 13 Apr 2014 12:27:16 -0400 Received: from plane.gmane.org ([80.91.229.3]:35588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZNFP-0001Kg-E5 for emacs-orgmode@gnu.org; Sun, 13 Apr 2014 12:27:11 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WZNFO-0004zt-GP for emacs-orgmode@gnu.org; Sun, 13 Apr 2014 18:27:10 +0200 Received: from e178190200.adsl.alicedsl.de ([85.178.190.200]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Apr 2014 18:27:10 +0200 Received: from tjolitz by e178190200.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Apr 2014 18:27:10 +0200 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 Richard Lawrence writes: Hi Richard, > Bastien writes: > >> Nicolas Goaziou writes: >> >>> Thorsten Jolitz writes: >>> >>>> What do you think - is there any chance that Org-mode switches from >>>> static hardcoded regexp strings (all over the place) to dynamic >>>> regexps calculated at runtime (using libraries like drx.el or rx.el)? >>> >>> I hope not. The syntax should stabilize, not drift away. >> >> Agreed. Maybe there are some hardcoded regexps that we can factor >> out, but dynamically building those fundamental regexp is a deadend. > > I agree with what Nicolas and Bastien have said, but I wanted to say > that I think there is an interesting idea in Thorsten's post that > shouldn't be dismissed out of hand. > > Org provides a set of UI concepts (tree-like structure, visibility > cycling, tree filtering, task state tracking, building an agenda from > multiple sources, ...) that map nicely onto a lot of other situations, > and would be really handy to have access to even when the syntax of the > underlying file is incompatible with Org's syntax. > > There are two ways to think about Org syntax, which I think should be > distinguished here. One is as the grammar of a .org file: basically, a > set of rules that allow a sequence of characters to be parsed into an > AST. The other way to think about Org syntax is the way Lisp > programmers sometimes talk about syntax: as the AST itself, the > collection of Lisp data types and their interrelationships that define a > valid Org document. > > If Org were to evolve to the point where the UI concepts were > implemented purely as transformations on an AST -- on Org syntax in the > second sense -- then the way would be clear for making those concepts > available in editing modes where the grammar of the underlying file is > incompatible with Org syntax in the first sense. A programming mode > could, say, parse comments into an Org AST, then expose that AST to the > functions implementing Org's UI concepts. Et voila: you get visibility > cycling, task state tracking, agendas...in your source code comments. > > One sort of use case where I think this idea could really shine is in > dealing with email. Obviously, the grammar of the underlying mail files > (say, in a Maildir) will never be compatible with Org syntax in the > first sense. But Org handles so many of the concepts that apply to > email (threading messages into hierarchies, visibility cycling, tagging, > sorting by date or priority, thinking of messages as tasks to be dealt > with, dealing with attachments) in such a nice way that I find myself > sorely missing Org whenever I read mail in a client that doesn't > implement them as nicely -- which is all of them. If it were possible > to build a parser for message files that transformed them into an Org > AST, the mail client of my dreams would be in reach. > > I have no idea if evolving Org in this direction is feasible or even > really desireable. It may be that the two notions of Org syntax are > tightly coupled in principle, so that the idea of producing an Org AST > from an alternative underlying file format will never make sense. But I > think that would be surprising. > > This evolution would clearly require more work than just abstracting out > the regular expressions that implement much of Org's syntax in the first > sense, and I think Bastien and Nicolas are right that we don't want > either notion of Org syntax to become less stable. Still, I think > there's a lot of interesting possibilities we could explore if Org's > implementations of the two notions of syntax were to become less tightly > coupled. thanks for your long and interesting comment! But thats very ambitious, I'm actually looking for something much more prosaic - being able to structure and use a buffer/file in a programming mode like an Org-mode buffer/file besides the fact the headlines and text needs to be outcommented. Thats partly possible with orgstruct or outshine, but I think there is potential for more if Org functions could deal with outcommented syntax-elements. And at the lowest level its all about regexps that don't match because there is comment-syntax behind the "^" and before the "$" (and maybe a different star is used instead of "*"), e.g. (outshine-style) Elisp ,-------------------- | "^;; \\* Headline$" `-------------------- oldschool Elisp ,----------------- | "^;;; Headline$" `----------------- or CSS ,----------------------- | "^/* \\* Headline */$" `----------------------- instead of the default Org-mode ,----------------- | "^\\* Headline$" `----------------- -- cheers, Thorsten