On 2015-02-23 at 03:35, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote: > Ken Mankoff <mank...@gmail.com> 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.
Hmm. It is happening on the latest melpa install. Or maybe on an earlier version and I'm only seeing it now. I run melpa, no git versions. > There is a function in ORG-NEWS that will repair old documents, but it will > _not_ merge duplicate properties drawers. Thanks for the hint. I've found that and run it, but get an error because "org-planning-line-re" 'symbols variable is void'. Searching that I see mention that error is indicative of a mixed installation. But when I grep (or ack) for "org-planning-line-re" in the elpa/org-20150216 folder, it doesn't exist. If I rewrite that line to "org-planning-or-clock-line-re", then it works, and I see items get repaired. I can run this on all my Org files, but as you point out, it won't help with tasks that are already messed up with two property drawers. I also don't think I have a mixed install because I cons elpa to the load-path before I access any Org functions. I've tried to run the code you sent: > (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)))) > But nothing happens. It seems to be an incomplete solution. I tried wrapping it in an interactive function call, but I'm a lisp newbie and it doesn't list the entries with duplicate properties for me, on this system. -k.