From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: duplicate PROPERTIES drawers Date: Mon, 23 Feb 2015 09:35:44 +0100 Message-ID: <87pp9158kf.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPoTQ-0006B6-3u for emacs-orgmode@gnu.org; Mon, 23 Feb 2015 03:34:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YPoTM-0005yq-Nx for emacs-orgmode@gnu.org; Mon, 23 Feb 2015 03:34:40 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:37586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPoTM-0005yc-HY for emacs-orgmode@gnu.org; Mon, 23 Feb 2015 03:34:36 -0500 In-Reply-To: (Ken Mankoff's message of "Sun, 22 Feb 2015 16:37:33 -0500") 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: Ken Mankoff Cc: Org-mode Hello, 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. 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