emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Is it possible to keep /all/ the heading properties in one place


From: Oleh Krehel
Subject: Re: [O] Is it possible to keep /all/ the heading properties in one place?
Date: Thu, 25 Feb 2016 20:17:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.90 (gnu/linux)

Nicolas Goaziou <address@hidden> 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. 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?

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 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.

> Parsing an Org document is a solved problem. I do not pretend the
> solution cannot be improved, but at least, it is complete.

Just like reading LISP is a solved problem. And not just in Emacs.

> I'm not sure about your motivations. If they are about reducing visual
> clutter, you can work it out at the display level. I'm pretty sure this
> improvement would be appreciated.

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:

    (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))
    ;; =>
    ;; ((deadline "<2016-02-26 Fri 17:00 +1w>") nil)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]