emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* duplicate PROPERTIES drawers
@ 2015-02-22 21:37 Ken Mankoff
  2015-02-23  8:35 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Mankoff @ 2015-02-22 21:37 UTC (permalink / raw)
  To: Org-mode


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. 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?

Thanks,

  -k.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: duplicate PROPERTIES drawers
  2015-02-22 21:37 duplicate PROPERTIES drawers Ken Mankoff
@ 2015-02-23  8:35 ` Nicolas Goaziou
  2015-02-23 14:02   ` Ken Mankoff
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2015-02-23  8:35 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: Org-mode

Hello,

Ken Mankoff <mankoff@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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: duplicate PROPERTIES drawers
  2015-02-23  8:35 ` Nicolas Goaziou
@ 2015-02-23 14:02   ` Ken Mankoff
  2015-02-23 15:44     ` Ken Mankoff
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Mankoff @ 2015-02-23 14:02 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode


On 2015-02-23 at 03:35, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Ken Mankoff <mankoff@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.
  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: duplicate PROPERTIES drawers
  2015-02-23 14:02   ` Ken Mankoff
@ 2015-02-23 15:44     ` Ken Mankoff
  0 siblings, 0 replies; 4+ messages in thread
From: Ken Mankoff @ 2015-02-23 15:44 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode


On 2015-02-23 at 09:02, Ken Mankoff <mankoff@gmail.com> wrote:
> On 2015-02-23 at 03:35, Nicolas Goaziou <mail@nicolasgoaziou.fr> 
> wrote:
>
> 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...

It looks like that function exists in 8.3 I've upgraded to 8.3beta 
(git) and now things work better.

  -k.
  

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-23 15:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-22 21:37 duplicate PROPERTIES drawers Ken Mankoff
2015-02-23  8:35 ` Nicolas Goaziou
2015-02-23 14:02   ` Ken Mankoff
2015-02-23 15:44     ` Ken Mankoff

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).