[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [RFC] Change property drawer syntax
From: |
Andreas Leha |
Subject: |
Re: [O] [RFC] Change property drawer syntax |
Date: |
Tue, 14 Oct 2014 15:55:34 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (darwin) |
Hi Nicolas,
My only 'concern' is that it looks awkward or at least unfamiliar when the
property drawer is closed (which it is always in my documents).
I guess than it would change from
*** Call XXX
:PROPERTIES:...
<2014-10-16 Thu 13:00-14:00>
to
*** Call XXX
<2014-10-16 Thu 13:00-14:00>
:PROPERTIES:...
which has a folded item 'in the middle of text' rather than right below the
heading.
I'll get used to that, I guess.
Regards,
Andreas
Nicolas Goaziou <address@hidden> writes:
> Hello,
>
> As discussed previously, I would like to modify property drawers syntax.
> The change is simple: they must be located right after a headline and
> its planning line, if any. Therefore the following cases are valid
>
> * Headline
> :PROPERTIES:
> :KEY: value
> :END:
>
> * Headline
> SCHEDULED: <2014-10-14 mar.>
> :PROPERTIES:
> :KEY: value
> :END:
>
> but, in the following case, the scheduled keyword will not be recognized
>
> * Headline
> :PROPERTIES:
> :KEY: value
> :END:
> SCHEDULED: <2014-10-14 mar.>
>
> When not empty, they also have to contain only node properties.
> Moreover, node properties' keys can only contain non-whitespace
> characters and cannot end with a plus sign (which is used for
> accumulation). Value can contain anything but a newline character.
>
> Thus, the following property drawer is invalid
>
> * Headline
> :PROPERTIES:
> :KEY: value
> Some text.
> :END:
>
> Any invalid property drawer becomes de facto a regular drawer, with
> "PROPERTIES" as its name.
>
> Besides defining exactly the syntax of property drawers, it should also
> make the property API faster in some cases. Indeed, there's no need to
> search through entire (possibly huge) sections in order to find
> properties attached to a headline.
>
> However, it will break some Org documents. In particular, TODO-states
> changes are usually logged before any drawer, including properties
> drawers. The following function repairs them.
>
> (defun org-repair-property-drawers ()
> "Fix properties drawers in current buffer.
> Ignore non Org buffers."
> (when (eq major-mode 'org-mode)
> (org-with-wide-buffer
> (goto-char (point-min))
> (let ((case-fold-search t)
> (inline-re (and (featurep 'org-inlinetask)
> (concat (org-inlinetask-outline-regexp)
> "END[ \t]*$"))))
> (org-map-entries
> (lambda ()
> (unless (and inline-re (org-looking-at-p inline-re))
> (save-excursion
> (let ((end (save-excursion (outline-next-heading) (point))))
> (forward-line)
> (when (org-looking-at-p org-planning-line-re)
> (forward-line))
> (when (and (< (point) end)
> (not (org-looking-at-p org-property-drawer-re))
> (save-excursion
> (re-search-forward org-property-drawer-re end
> t)))
> (insert (delete-and-extract-region
> (match-beginning 0)
> (min (1+ (match-end 0)) end)))
> (unless (bolp) (insert "\n"))))))))))))
>
> Internally, changes are somewhat invasive, as they include a rewrite of
> almost all the property API. They also alter clocking, tags, todo
> keywords, logging, initialization, hopefully in an invisible manner.
>
> I pushed a new branch, "top-properties" in the repository for code
> review and testing. It includes unit tests, documentation and an
> ORG-NEWS entry.
>
> Feedback welcome.
>
>
> Regards,