Re: [O] [PATCH] org-agenda-list (from git) giving "args-out-of-range error"

2012-03-04 Thread Karl Fogel
David Maus  writes:
>I pushed the fix with some small cleanup of the commit
>message. Somehow the patchtracker included the mailbody in the commit
>message.

Thank you!

FWIW, I used 'git format-patch' to generate the patch; not sure if that
had anything to do with the resulting patchtracker behavior.


pgp315l3hxmAF.pgp
Description: PGP signature


Re: [O] [PATCH] org-agenda-list (from git) giving "args-out-of-range error"

2012-03-04 Thread David Maus
Hi Karl,

At Wed, 29 Feb 2012 13:45:05 -0600,
Karl Fogel wrote:
>
> [1  ]
> Nick Dokos  writes:
> >Exactly what you've done: send the patch to the list.
> >
> >Modulo possible changelog formatting issues (see
> >http://orgmode.org/worg/org-contribute.html#sec-5 for the gory details),
> >the patch looks good to me. Thanks for submitting it!
>
> Oh, thanks -- I should have looked for those guidelines first.  Here is
> the same patch, but with a properly-done log message this time.

I pushed the fix with some small cleanup of the commit
message. Somehow the patchtracker included the mailbody in the commit
message.

Best and thanks for the patch,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. dm...@ictsoc.de

pgpbs9CEJlZsT.pgp
Description: OpenPGP Digital Signature


Re: [O] [PATCH] org-agenda-list (from git) giving "args-out-of-range error"

2012-02-29 Thread Karl Fogel
Nick Dokos  writes:
>Exactly what you've done: send the patch to the list.
>
>Modulo possible changelog formatting issues (see
>http://orgmode.org/worg/org-contribute.html#sec-5 for the gory details),
>the patch looks good to me. Thanks for submitting it!

Oh, thanks -- I should have looked for those guidelines first.  Here is
the same patch, but with a properly-done log message this time.

I already have copyright assignment papers on file at the FSF for Emacs
itself, by the way; does that cover us for Org Mode too?

>From 7809b35a6e88640006753e28bcb87a6b66a80639 Mon Sep 17 00:00:00 2001
From: Karl Fogel 
Date: Wed, 29 Feb 2012 13:42:35 -0600
Subject: [PATCH] Fix bug whereby a date-only line caused an error when
 generating an agenda

* lisp/org-agenda.el (org-agenda-highlight-todo): Handle the case of a heading 
that has a date but no todo keyword.

This is a fix for the args-out-of-range bug discussed in these threads:

  http://thread.gmane.org/gmane.emacs.orgmode/52621
  http://thread.gmane.org/gmane.emacs.orgmode/52793
  http://thread.gmane.org/gmane.emacs.orgmode/52786
  http://thread.gmane.org/gmane.emacs.orgmode/52810

The discussions involved Ilya Shlyakhter, James Atwood, Nick Dokos,
and myself, and the subject headers are:

  bug report: agenda timeline crashes
  Bug report: weekly agenda and blank, timestamped headers
  org-agenda-list (from git) giving "args-out-of-range error"

TINYCHANGE
---
 lisp/org-agenda.el |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 98a2cc0..ac1b5b1 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5889,8 +5889,18 @@ could bind the variable in the options section of a 
custom command.")
   (let ((pl (text-property-any 0 (length x) 'org-heading t x)))
(setq re (get-text-property 0 'org-todo-regexp x))
(when (and re
+  ;; Test `pl' because if there's no heading content,
+  ;; there's no point matching to highlight.  Note
+  ;; that if we didn't test `pl' first, and there
+  ;; happened to be no keyword from `org-todo-regexp'
+  ;; on this heading line, then the `equal' comparison
+  ;; afterwards would spuriously succeed in the case
+  ;; where `pl' is nil -- causing an args-out-of-range
+  ;; error when we try to add text properties to text
+  ;; that isn't there.
+  pl
   (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
-   x (or pl 0)) pl))
+   x pl) pl))
  (add-text-properties
   (or (match-end 1) (match-end 0)) (match-end 0)
   (list 'face (org-get-todo-face (match-string 2 x)))
-- 
1.7.9



Re: [O] [PATCH] org-agenda-list (from git) giving "args-out-of-range error"

2012-02-29 Thread Nick Dokos
Karl Fogel  wrote:

> Nick Dokos  writes:
> >There have been a couple of recent reports on this problem (headlines
> >with just a timestamp cause this error) in addition to the ones you
> >found:
> >
> >http://thread.gmane.org/gmane.emacs.orgmode/52621
> >http://thread.gmane.org/gmane.emacs.orgmode/52786
> >
> >The first one contains a diagnosis and a (possibly wrong) suggested fix.
> 
> Thank you, Nick.  I eventually found the same cause, by doing a
> binary-search reduction of the problematic .org file until I knew
> exactly which headline was the source of the problem.  It was a
> second-level headline with a date but no content...
> 
>   ** <2012-02-27 Mon>
> 
> ...as described in James Atwood's mail (the second one you list above).
> 
> It's relevant that the line ends immediately after the ">".  If there is
> even one space after the ">", then the bug does not reproduce.  This
> makes sense, given the code.  I have a tentative patch, which is
> attached.  What's the typical way to submit such things for review?
> 

Exactly what you've done: send the patch to the list.

Modulo possible changelog formatting issues (see
http://orgmode.org/worg/org-contribute.html#sec-5 for the gory details),
the patch looks good to me. Thanks for submitting it!

Nick


> From 8a4c65479b2f62cbffe32735c4afac5dd6a1ecae Mon Sep 17 00:00:00 2001
> From: Karl Fogel 
> Date: Wed, 29 Feb 2012 13:06:06 -0600
> Subject: [PATCH] * lisp/org-agenda.el (org-agenda-highlight-todo): Handle the
>  case of a heading that has a date but no todo keyword. 
>  This is a fix for the args-out-of-range bug discussed in
>  these threads
> 
>   http://thread.gmane.org/gmane.emacs.orgmode/52621
>   http://thread.gmane.org/gmane.emacs.orgmode/52793
>   http://thread.gmane.org/gmane.emacs.orgmode/52786
>   http://thread.gmane.org/gmane.emacs.orgmode/52810
> 
> among Ilya Shlyakhter, James Atwood, Nick Dokos, and myself.  The subject 
> headers are:
> 
>   bug report: agenda timeline crashes
>   Bug report: weekly agenda and blank, timestamped headers
>   org-agenda-list (from git) giving "args-out-of-range error"
> ---
>  lisp/org-agenda.el |   12 +++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 98a2cc0..ac1b5b1 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -5889,8 +5889,18 @@ could bind the variable in the options section of a 
> custom command.")
>(let ((pl (text-property-any 0 (length x) 'org-heading t x)))
>   (setq re (get-text-property 0 'org-todo-regexp x))
>   (when (and re
> +;; Test `pl' because if there's no heading content,
> +;; there's no point matching to highlight.  Note
> +;; that if we didn't test `pl' first, and there
> +;; happened to be no keyword from `org-todo-regexp'
> +;; on this heading line, then the `equal' comparison
> +;; afterwards would spuriously succeed in the case
> +;; where `pl' is nil -- causing an args-out-of-range
> +;; error when we try to add text properties to text
> +;; that isn't there.
> +pl
>  (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
> - x (or pl 0)) pl))
> + x pl) pl))
> (add-text-properties
>  (or (match-end 1) (match-end 0)) (match-end 0)
>  (list 'face (org-get-todo-face (match-string 2 x)))
> -- 
> 1.7.9
> 



[O] [PATCH] org-agenda-list (from git) giving "args-out-of-range error"

2012-02-29 Thread Karl Fogel
Nick Dokos  writes:
>There have been a couple of recent reports on this problem (headlines
>with just a timestamp cause this error) in addition to the ones you
>found:
>
>http://thread.gmane.org/gmane.emacs.orgmode/52621
>http://thread.gmane.org/gmane.emacs.orgmode/52786
>
>The first one contains a diagnosis and a (possibly wrong) suggested fix.

Thank you, Nick.  I eventually found the same cause, by doing a
binary-search reduction of the problematic .org file until I knew
exactly which headline was the source of the problem.  It was a
second-level headline with a date but no content...

  ** <2012-02-27 Mon>

...as described in James Atwood's mail (the second one you list above).

It's relevant that the line ends immediately after the ">".  If there is
even one space after the ">", then the bug does not reproduce.  This
makes sense, given the code.  I have a tentative patch, which is
attached.  What's the typical way to submit such things for review?

>From 8a4c65479b2f62cbffe32735c4afac5dd6a1ecae Mon Sep 17 00:00:00 2001
From: Karl Fogel 
Date: Wed, 29 Feb 2012 13:06:06 -0600
Subject: [PATCH] * lisp/org-agenda.el (org-agenda-highlight-todo): Handle the
 case of a heading that has a date but no todo keyword. 
 This is a fix for the args-out-of-range bug discussed in
 these threads

  http://thread.gmane.org/gmane.emacs.orgmode/52621
  http://thread.gmane.org/gmane.emacs.orgmode/52793
  http://thread.gmane.org/gmane.emacs.orgmode/52786
  http://thread.gmane.org/gmane.emacs.orgmode/52810

among Ilya Shlyakhter, James Atwood, Nick Dokos, and myself.  The subject 
headers are:

  bug report: agenda timeline crashes
  Bug report: weekly agenda and blank, timestamped headers
  org-agenda-list (from git) giving "args-out-of-range error"
---
 lisp/org-agenda.el |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 98a2cc0..ac1b5b1 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5889,8 +5889,18 @@ could bind the variable in the options section of a 
custom command.")
   (let ((pl (text-property-any 0 (length x) 'org-heading t x)))
(setq re (get-text-property 0 'org-todo-regexp x))
(when (and re
+  ;; Test `pl' because if there's no heading content,
+  ;; there's no point matching to highlight.  Note
+  ;; that if we didn't test `pl' first, and there
+  ;; happened to be no keyword from `org-todo-regexp'
+  ;; on this heading line, then the `equal' comparison
+  ;; afterwards would spuriously succeed in the case
+  ;; where `pl' is nil -- causing an args-out-of-range
+  ;; error when we try to add text properties to text
+  ;; that isn't there.
+  pl
   (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
-   x (or pl 0)) pl))
+   x pl) pl))
  (add-text-properties
   (or (match-end 1) (match-end 0)) (match-end 0)
   (list 'face (org-get-todo-face (match-string 2 x)))
-- 
1.7.9