From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Is it possible to keep /all/ the heading properties in one place? Date: Thu, 25 Feb 2016 21:16:46 +0100 Message-ID: <87a8mo1r69.fsf@nicolasgoaziou.fr> References: <87fuwht5s3.fsf@gmail.com> <87lh683o7c.fsf@nicolasgoaziou.fr> <878u28ucl8.fsf@gmail.com> <878u283n15.fsf@nicolasgoaziou.fr> <87oab4sw70.fsf@gmail.com> <87h9gw20mi.fsf@nicolasgoaziou.fr> <87a8mooazg.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ2JB-0008Uw-NX for emacs-orgmode@gnu.org; Thu, 25 Feb 2016 15:14:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZ2J8-0003pQ-Uo for emacs-orgmode@gnu.org; Thu, 25 Feb 2016 15:14:45 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:45824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ2J8-0003op-NG for emacs-orgmode@gnu.org; Thu, 25 Feb 2016 15:14:42 -0500 In-Reply-To: <87a8mooazg.fsf@gmail.com> (Oleh Krehel's message of "Thu, 25 Feb 2016 20:17:55 +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: Oleh Krehel Cc: emacs-orgmode@gnu.org Oleh Krehel writes: > Nicolas Goaziou writes: >> I do not feel like asking users to write directly the AST for their >> plain text documents, really. > > It's not an AST though. It's simply nested lists. So is Lisp. > Like JSON or XML but better. And the idea is to both have it automatic > and manual. For example, `org-set-property' would work exactly as it > does right now - interactively. But on the programming level it would > use `read', `delete-sexp', `plist-put' and `prin1'. Isn't it much > better to defer all the heavy lifting to the Elisp reader? No it isn't, IMO. It boils down to ask users to write Lisp by hand at some point. Not everyone wants to use interactive tools. Unfortunately, writing Lisp is not fun in a basic text editing environment. > Additionally, LISP readers are readily available outside of Emacs. It > would ease other projects' Org-mode integration. Like mobile apps, > taskwarrior, github, whatever - the people would be able to parse and > modify Org with simply: > > import lisp_reader > > instead of grokking the full Org property syntax Here is the full Org property syntax: --8<---------------cut here---------------start------------->8--- 3.7 Property Drawers =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80 Property drawers are a special type of drawer containing properties attached to a headline. They are located right after a [headline] and its [planning] information. =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 HEADLINE =E2=94=82 PROPERTYDRAWER =E2=94=82=20 =E2=94=82 HEADLINE =E2=94=82 PLANNING =E2=94=82 PROPERTYDRAWER =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 PROPERTYDRAWER follows the pattern =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 :PROPERTIES: =E2=94=82 CONTENTS =E2=94=82 :END: =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 where CONTENTS consists of zero or more [node properties]. 4.9 Node Properties =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80 Node properties can only exist in [property drawers]. Their pattern is any of the following =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 :NAME: VALUE =E2=94=82=20 =E2=94=82 :NAME+: VALUE =E2=94=82=20 =E2=94=82 :NAME: =E2=94=82=20 =E2=94=82 :NAME+: =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 NAME can contain any non-whitespace character but cannot end with a plus sign. It cannot be the empty string. VALUE can contain anything but a newline character. --8<---------------cut here---------------end--------------->8--- I don't think this is very impressive nor particularly difficult to implement. > and all if its oddities and idiosyncrasies. Because the basic Org > heading structure is genius simple. It's all the extra "stuff" than > drags it down in terms of simplicity. You may want to have a look at "outline.el", which is Org without all the extra "stuff". > The motivation is to have Org look simpler by virtue of /being/ simpler. > Compare (require 'org-element) and hours of grokking it and looking up > docs to simply: You don't have to grok "org-element.el" which is but an implementation of Org syntax. See instead. > (defun all-props () > (save-excursion > (goto-char (point-min)) > (let (props) > (while (re-search-forward "^(properties" nil t) > (goto-char (match-beginning 0)) > (push (read (current-buffer)) props)) > (nreverse props)))) > (mapcar (lambda (p) > (assoc 'deadline (cdr p))) > (all-props)) > ;; =3D> > ;; ((deadline "<2016-02-26 Fri 17:00 +1w>") nil) Alas, the Devil is in the detail: (example ... (properties ...)) Anyway, at this point I don't know what to add. You want to improve Org and this is fine. However simplistic examples do not help understanding the full picture, at least for me. So, implement your idea, test the syntax, ask for feedback here. In the end, if it happens to be superior, users will naturally switch to it, for the benefit of everyone. You may also want to have a look at Skribilo (http://www.nongnu.org/skribilo/), if you don't know it already. Regards, --=20 Nicolas