emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] duplicate PROPERTIES drawers


From: Nicolas Goaziou
Subject: Re: [O] duplicate PROPERTIES drawers
Date: Mon, 23 Feb 2015 09:35:44 +0100

Hello,

Ken Mankoff <address@hidden> writes:

> I have found many task with duplicate PROPERTIES drawers. I saw mention
> on the list that, "...it will be invalid for a LOGBOOK to
> appear before PROPERTIES in Org 8.3."
>
> It seems that tasks don't have properties by default, and if I LOG an
> item, I get a LOGBOOK drawer. If properties are added later (by touching
> the item with MobileOrg, or adding a property with "C-c C-x p", then
> PROPERTIES go below the LOGBOOK.

This shouldn't happen in master branch.

There is a function in ORG-NEWS that will repair old documents, but it
will _not_ merge duplicate properties drawers.

> I'm not sure what is going on to create the second PROPERTIES drawer.
>
> Has anyone else seen this? Any ideas what I am doing wrong.
>
> I've found many of these tasks manually. I haven't been able to search
> and list them progragmatically (I've been trying using grep and other
> shell tools on my Org files).
>
> Is there a way to list all tasks with duplicate properties, or all tasks
> where :PROPERTIES: is not the first item listed, if that is a
> requirement?

This should find such entries.

  (org-element-map (org-element-parse-buffer 'element) 'headline
    (lambda (h)
      (and (org-element-map h 'drawer
             (lambda (d) (equal (org-element-property :name d) "PROPERTIES"))
             nil t 'headline)
           (let ((begin (org-element-property :begin h)))
             (message "Entry with erroneous properties drawer at %d" begin)
             begin))))

Regards,

-- 
Nicolas Goaziou



reply via email to

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