Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-10 Thread Rainer Stengele
Am 09.04.2012 16:51, schrieb Bastien:
 Hi Dave,
 
 Dave Abrahams d...@boostpro.com writes:
 
 Sorry, but I don't want to spend the time on that.  I'm trying to get
 the rules changed so that it isn't so easy to corrupt an org file.  
 
 The current rule is Leave SCHEDULED: and DEADLINE: information where
 Org's `org-schedule' and `org-deadline' put it.
 
 Maybe I don't understand how do you want to change this rule.
 
 I'm not much interested in building a tool to undo corruption.

 FYI: Nicolas and I have been discussing about the issue you raised, and
 the integration of org-element.el will force us to be clearer about such
 cases, which is good.

 I sincerely hope that when you become clearer about such cases you pick
 a liberal set of rules that isn't so error-prone.  The ideas that I
 can't just hit return after a headline and start typing a body, and that
 I'll be nagged about misplaced SCHEDULED: lines, are both very
 unappealing.
 
 I have just added this hack:
 
   Check for misplaced SCHEDULED and DEADLINE cookies
   http://orgmode.org/worg/org-hacks.html#sec-1-2-8
 
 Here is the function:
 
 (defun org-check-misformatted-subtree ()
   Check misformatted entries in the current buffer.
   (interactive)
   (show-all)
   (org-map-entries
(lambda ()
  (move-beginning-of-line 2)
  (if (or (and (org-get-scheduled-time (point))
   (not (looking-at (concat ^.* org-scheduled-regexp
  (and (org-get-deadline-time (point))
   (not (looking-at (concat ^.* org-deadline-regexp)
  (when (y-or-n-p Fix this subtree? )
(message Call the function again when you're done fixing this 
 subtree.)
(recursive-edit))
(message All subtrees checked.)
 
 HTH,
 

Bastien,

why does the function fire in this case:


* test
** TODO task
   SCHEDULED: 2012-04-10 Di


Did I misunderstand?

Rainer




Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-10 Thread Bastien
Hi Rainer,

Rainer Stengele rainer.steng...@online.de writes:

 why does the function fire in this case:

 * test
 ** TODO task
SCHEDULED: 2012-04-10 Di

Because it was buggy -- here is a better version (also updated on Worg)

(defun org-check-misformatted-subtree ()
  Check misformatted entries in the current buffer.
  (interactive)
  (show-all)
  (org-map-entries
   (lambda ()
 (when (and (move-beginning-of-line 2)
(not (looking-at org-heading-regexp)))
   (if (or (and (org-get-scheduled-time (point))
(not (looking-at (concat ^.* org-scheduled-regexp
   (and (org-get-deadline-time (point))
(not (looking-at (concat ^.* org-deadline-regexp)
   (when (y-or-n-p Fix this subtree? )
 (message Call the function again when you're done fixing this 
subtree.)
 (recursive-edit))
 (message All subtrees checked.))

Thanks for testing!

-- 
 Bastien



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-09 Thread Bastien
Dave Abrahams d...@boostpro.com writes:

 Given the following:

 * TODO Some headline
 SCHEDULED: 2012-04-05 Thu

 If I add body text between the headline and the SCHEDULED: line, some
 things work, but others don't.  

 See this footnote in the section 8.3.1 Inserting deadlines or
 schedules of the manual:

(1) The `SCHEDULED' and `DEADLINE' dates are inserted on the line
 right below the headline.  Don't put any text between this line and the
 headline.

 That doesn't make it right.  

No, but it makes it clear that users should put SCHEDULED: ... lines
right after the headline.  

 This is a serious usability bug and a newbie trap.

 As I mentioned in my report, if some of the commands can handle it,
 there's no reason all of them shouldn't handle it.  

 The only other valid interpretation is that those commands that are
 handling it as I expect are broken and they're changing things that
 should really be treated as body text and just happen to look like a
 SCHEDULED line.

Patch welcome.

Or even more useful: write a small function that goes an Org buffer 
and spot misformatted subtrees, offering to fix them interactively.
Can you write this?

Thanks,

-- 
 Bastien



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-09 Thread Dave Abrahams

on Mon Apr 09 2012, Bastien bzg-AT-gnu.org wrote:

 This is a serious usability bug and a newbie trap.

 As I mentioned in my report, if some of the commands can handle it,
 there's no reason all of them shouldn't handle it.  

 The only other valid interpretation is that those commands that are
 handling it as I expect are broken and they're changing things that
 should really be treated as body text and just happen to look like a
 SCHEDULED line.

 Patch welcome.

 Or even more useful: write a small function that goes an Org buffer 
 and spot misformatted subtrees, offering to fix them interactively.
 Can you write this?

Actually:

1. I strongly disagree that that would be more useful.  It would leave
   the newbie trap and usability bug in place.

2. John Wiegley has been working on some code that allows such things to
   be trivially implemented and I'd rather not duplicate / overlap with
   him.  John, would you care to push your org-x stuff upstream soon?

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-09 Thread Bastien
Hi Dave,

Dave Abrahams d...@boostpro.com writes:

 1. I strongly disagree that that would be more useful.  It would leave
the newbie trap and usability bug in place.

Well, we disagree then :)  I think it is useful to have a function that
let everyone (not just newbies) know that some subtrees don't respect
Org's writing conventions.

 2. John Wiegley has been working on some code that allows such things to
be trivially implemented and I'd rather not duplicate / overlap with
him.  John, would you care to push your org-x stuff upstream soon?

You might also look at org-element.el.  

FYI: Nicolas and I have been discussing about the issue you raised, and
the integration of org-element.el will force us to be clearer about such
cases, which is good.

In the meantime, let's restate this again: don't put SCHEDULED: and
DEADLINE: cookies anywhere else than on the line right below the
headline.

Thanks,

-- 
 Bastien



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-09 Thread Dave Abrahams

on Mon Apr 09 2012, Bastien bzg-AT-gnu.org wrote:

 Hi Dave,

 Dave Abrahams d...@boostpro.com writes:

 1. I strongly disagree that that would be more useful.  It would leave
the newbie trap and usability bug in place.

 Well, we disagree then :)  I think it is useful to have a function that
 let everyone (not just newbies) know that some subtrees don't respect
 Org's writing conventions.

It would be very useful.  Just not /more/ useful.  The most useful
functionality is the one that just works without any intervention from
the user.

 2. John Wiegley has been working on some code that allows such things to
be trivially implemented and I'd rather not duplicate / overlap with
him.  John, would you care to push your org-x stuff upstream soon?

 You might also look at org-element.el.  

Sorry, but I don't want to spend the time on that.  I'm trying to get
the rules changed so that it isn't so easy to corrupt an org file.  I'm
not much interested in building a tool to undo corruption.

 FYI: Nicolas and I have been discussing about the issue you raised, and
 the integration of org-element.el will force us to be clearer about such
 cases, which is good.

I sincerely hope that when you become clearer about such cases you pick
a liberal set of rules that isn't so error-prone.  The ideas that I
can't just hit return after a headline and start typing a body, and that
I'll be nagged about misplaced SCHEDULED: lines, are both very
unappealing.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-09 Thread Bastien
Hi Dave,

Dave Abrahams d...@boostpro.com writes:

 Sorry, but I don't want to spend the time on that.  I'm trying to get
 the rules changed so that it isn't so easy to corrupt an org file.  

The current rule is Leave SCHEDULED: and DEADLINE: information where
Org's `org-schedule' and `org-deadline' put it.

Maybe I don't understand how do you want to change this rule.

 I'm not much interested in building a tool to undo corruption.

 FYI: Nicolas and I have been discussing about the issue you raised, and
 the integration of org-element.el will force us to be clearer about such
 cases, which is good.

 I sincerely hope that when you become clearer about such cases you pick
 a liberal set of rules that isn't so error-prone.  The ideas that I
 can't just hit return after a headline and start typing a body, and that
 I'll be nagged about misplaced SCHEDULED: lines, are both very
 unappealing.

I have just added this hack:

  Check for misplaced SCHEDULED and DEADLINE cookies
  http://orgmode.org/worg/org-hacks.html#sec-1-2-8

Here is the function:

(defun org-check-misformatted-subtree ()
  Check misformatted entries in the current buffer.
  (interactive)
  (show-all)
  (org-map-entries
   (lambda ()
 (move-beginning-of-line 2)
 (if (or (and (org-get-scheduled-time (point))
  (not (looking-at (concat ^.* org-scheduled-regexp
 (and (org-get-deadline-time (point))
  (not (looking-at (concat ^.* org-deadline-regexp)
 (when (y-or-n-p Fix this subtree? )
   (message Call the function again when you're done fixing this 
subtree.)
   (recursive-edit))
   (message All subtrees checked.)

HTH,

-- 
 Bastien



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-09 Thread Dave Abrahams

on Mon Apr 09 2012, Bastien bzg-AT-altern.org wrote:

 Hi Dave,

 Dave Abrahams d...@boostpro.com writes:

 Sorry, but I don't want to spend the time on that.  I'm trying to get
 the rules changed so that it isn't so easy to corrupt an org file.  

 The current rule is Leave SCHEDULED: and DEADLINE: information where
 Org's `org-schedule' and `org-deadline' put it.

 Maybe I don't understand how do you want to change this rule.

I want the rule to be that you can have as much body text as you want
between the headline and the SCHEDULED: line.  Or failing that, I'd like
org's default keybindings to make it really hard to insert text between
the headline and SCHEDULED:.  Any typing in that area should, by
default, force the point to jump after SCHEDULED:

 I sincerely hope that when you become clearer about such cases you pick
 a liberal set of rules that isn't so error-prone.  The ideas that I
 can't just hit return after a headline and start typing a body, and that
 I'll be nagged about misplaced SCHEDULED: lines, are both very
 unappealing.

 I have just added this hack:

   Check for misplaced SCHEDULED and DEADLINE cookies
   http://orgmode.org/worg/org-hacks.html#sec-1-2-8

 Here is the function:

 (defun org-check-misformatted-subtree ()
   Check misformatted entries in the current buffer.
   (interactive)
   (show-all)
   (org-map-entries
(lambda ()
  (move-beginning-of-line 2)
  (if (or (and (org-get-scheduled-time (point))
   (not (looking-at (concat ^.* org-scheduled-regexp
  (and (org-get-deadline-time (point))
   (not (looking-at (concat ^.* org-deadline-regexp)
  (when (y-or-n-p Fix this subtree? )
(message Call the function again when you're done fixing this 
 subtree.)
(recursive-edit))
(message All subtrees checked.)

Thanks, I think... but I can't tell if everybody is missing my point.
I've been trying to argue for something that doesn't allow mistakes to
happen in the first place.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-09 Thread Bastien
Hi Dave,

Dave Abrahams d...@boostpro.com writes:

 I want the rule to be that you can have as much body text as you want
 between the headline and the SCHEDULED: line.  

This won't happen.  

 Or failing that, I'd like
 org's default keybindings to make it really hard to insert text between
 the headline and SCHEDULED:.  Any typing in that area should, by
 default, force the point to jump after SCHEDULED:

Yes, this is a possibility.  The other possibility is to store SCHEDULED
and DEADLINE information in a drawer.

In both cases, this requires a careful discussion.

As I cannot spend this time right now, the helper function to fix
misformatted subtrees is better than nothing.  And unless there is 
a Global Internet Strike (©) requesting this issue to be fixed,
I think we should live with it -- or make a collective effort.

 Thanks, I think... but I can't tell if everybody is missing my point.
 I've been trying to argue for something that doesn't allow mistakes to
 happen in the first place.

I understand.

But again: the mistake happens for people who move this line manually
and for poeple who don't read the manual.

Thanks for your understanding!

-- 
 Bastien



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-09 Thread Dave Abrahams

on Mon Apr 09 2012, Bastien bzg-AT-gnu.org wrote:

 Hi Dave,

 Dave Abrahams d...@boostpro.com writes:

 I want the rule to be that you can have as much body text as you want
 between the headline and the SCHEDULED: line.  

 This won't happen.  

Because...?

 Or failing that, I'd like
 org's default keybindings to make it really hard to insert text between
 the headline and SCHEDULED:.  Any typing in that area should, by
 default, force the point to jump after SCHEDULED:

 Yes, this is a possibility.  The other possibility is to store SCHEDULED
 and DEADLINE information in a drawer.

That would be an easy solution.

 In both cases, this requires a careful discussion.

 As I cannot spend this time right now, the helper function to fix
 misformatted subtrees is better than nothing.  

Yes.

 And unless there is a Global Internet Strike (©) requesting this issue
 to be fixed, I think we should live with it -- or make a collective
 effort.

I understand.

 Thanks, I think... but I can't tell if everybody is missing my point.
 I've been trying to argue for something that doesn't allow mistakes
 to happen in the first place.

 I understand.

 But again: the mistake happens for people who move this line manually
 and for poeple who don't read the manual.

And again: this is a developer-centric response.  As a matter of
usability it doesn't matter very much that you told me so (in a manual
100s of pages long --- and it's buried in a footnote, for chrissake!)
when the mistake is trivially easy to make... and it is.  I only have
only ever moved that line without knowing I was doing it.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-09 Thread John Wiegley
 Bastien  b...@gnu.org writes:

 You might also look at org-element.el.

 FYI: Nicolas and I have been discussing about the issue you raised, and the
 integration of org-element.el will force us to be clearer about such cases,
 which is good.

I think Org-X and org-element can be merged.

Org-X is a bidirectional system for turning Org entries into Lisp structure,
and back again.  Because of this bidirectionality, it lets you send Org
entries to other Backends (like Redmine, Bugzilla, etc.), and also
receive/sync Org entries with those backends.

While Org-X does parse major structural elements within entries (the scheduled
date, property drawer, and a few others), it makes no attempt to interpret the
textual content of entries, nor does it deal with whole trees, or the
ancillary data outside of heading lines (like the #+keyword markers).

It might be very useful at this point to combine the efforts of these two
projects into a complete abstraction layer for Org.  And it would be
unfortunate to have two entirely separate efforts with different areas of
focus, fragmenting the community of people who want to work with their Org
data programmatically.

I've been using Org-X for utility code for many months now, and I'm ready to
push it to mainstream.  It simply needs some documentation at this point.

If you guys are interested in merging org-element and Org-X, we should discuss
that.  Org-X is already doing a few of the things that org-element does, but I
don't believe org-element is doing much of what Org-X does, in terms of
built-in support for shuttling data to/from various backends.  Even the
Org-mode support itself is implemented as a backend on top of a more general
abstraction layer.

John



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-06 Thread Bastien
Hi Dave,

Dave Abrahams d...@boostpro.com writes:

 Given the following:

 * TODO Some headline
 SCHEDULED: 2012-04-05 Thu

 If I add body text between the headline and the SCHEDULED: line, some
 things work, but others don't.  

See this footnote in the section 8.3.1 Inserting deadlines or
schedules of the manual:

   (1) The `SCHEDULED' and `DEADLINE' dates are inserted on the line
right below the headline.  Don't put any text between this line and the
headline.

HTH,

-- 
 Bastien



Re: [O] Bug: SCHEDULED: positioning is fragile [7.8.06 (release_7.8.06.181.ga481)]

2012-04-06 Thread Dave Abrahams

on Fri Apr 06 2012, Bastien bzg-AT-gnu.org wrote:

 Hi Dave,

 Dave Abrahams d...@boostpro.com writes:

 Given the following:

 * TODO Some headline
 SCHEDULED: 2012-04-05 Thu

 If I add body text between the headline and the SCHEDULED: line, some
 things work, but others don't.  

 See this footnote in the section 8.3.1 Inserting deadlines or
 schedules of the manual:

(1) The `SCHEDULED' and `DEADLINE' dates are inserted on the line
 right below the headline.  Don't put any text between this line and the
 headline.

That doesn't make it right.  This is a serious usability bug and a
newbie trap.

As I mentioned in my report, if some of the commands can handle it,
there's no reason all of them shouldn't handle it.  The only other valid
interpretation is that those commands that are handling it as I expect
are broken and they're changing things that should really be treated as
body text and just happen to look like a SCHEDULED line.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com