From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ken Mankoff Subject: Re: duplicate PROPERTIES drawers Date: Mon, 23 Feb 2015 09:02:17 -0500 Message-ID: References: <87pp9158kf.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPtab-0000r2-Fy for emacs-orgmode@gnu.org; Mon, 23 Feb 2015 09:02:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YPtaV-00037z-QE for emacs-orgmode@gnu.org; Mon, 23 Feb 2015 09:02:25 -0500 Received: from mail-qg0-x22b.google.com ([2607:f8b0:400d:c04::22b]:62799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPtaV-00037u-LG for emacs-orgmode@gnu.org; Mon, 23 Feb 2015 09:02:19 -0500 Received: by mail-qg0-f43.google.com with SMTP id i50so24381857qgf.2 for ; Mon, 23 Feb 2015 06:02:19 -0800 (PST) In-reply-to: <87pp9158kf.fsf@nicolasgoaziou.fr> 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: Nicolas Goaziou Cc: Org-mode On 2015-02-23 at 03:35, Nicolas Goaziou wrote: > Ken Mankoff 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.