emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Date tree capture regexp for headline matching has changed.
@ 2011-05-10  0:35 Charles Cave
  2011-05-10  1:03 ` Charles Cave
  0 siblings, 1 reply; 5+ messages in thread
From: Charles Cave @ 2011-05-10  0:35 UTC (permalink / raw)
  To: emacs-orgmode

I use date-trees extensively for capturing Todo list items 
and appointments.

I noticed a change of behaviour between 7.4 and 7.5

In the date tree, I annotate the Monday date with a week number so
I can see the beginning of a week at a glance. for example:

*** 2011-05-09 Sunday
*** 2011-05-09 Monday          Week 19
**** Note one
**** Note two

Since version 7.5, if I add the Week 19 text, the next time
I do a capture, a new day heading is made. In version 7.4 and earlier
the headline matched from the beginning, but now it seems the entire
line is matched.

Why has this behaviour changed?

I consider this an unnecessary change / annoyance.  Can this
behaviour be changed back to the old way?  

Thank you
Charles 

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

* Re: Date tree capture regexp for headline matching has changed.
  2011-05-10  0:35 Date tree capture regexp for headline matching has changed Charles Cave
@ 2011-05-10  1:03 ` Charles Cave
  2011-05-10  1:17   ` Bernt Hansen
  2011-05-10  1:34   ` Nick Dokos
  0 siblings, 2 replies; 5+ messages in thread
From: Charles Cave @ 2011-05-10  1:03 UTC (permalink / raw)
  To: emacs-orgmode

I compared org-datetre.el from 7.4 to 7.5 and got the following
diff output (edited)

I can see that the regular expression has become more restricted
with the addition of  \\w+$"  at the end.

At least I know what to manually change to make orgmode work the
way I want it.


105c105   (this is the org-datetree-find-day-create function 
7.4: (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\)[ \t\n]" year month))
---
7.5: (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" year month))

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

* Re: Date tree capture regexp for headline matching has changed.
  2011-05-10  1:03 ` Charles Cave
@ 2011-05-10  1:17   ` Bernt Hansen
  2011-05-10  1:34   ` Nick Dokos
  1 sibling, 0 replies; 5+ messages in thread
From: Bernt Hansen @ 2011-05-10  1:17 UTC (permalink / raw)
  To: Charles Cave; +Cc: emacs-orgmode

Charles Cave <charles.cave@gmail.com> writes:

> I compared org-datetre.el from 7.4 to 7.5 and got the following
> diff output (edited)
>
> I can see that the regular expression has become more restricted
> with the addition of  \\w+$"  at the end.
>
> At least I know what to manually change to make orgmode work the
> way I want it.
>
>
> 105c105   (this is the org-datetree-find-day-create function 
> 7.4: (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\)[ \t\n]" year month))
> ---
> 7.5: (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" year month))

Hi Charles,

According to git blame, this change was done in

,----
| commit d9eeb15ab9d55316f08cd7efe818119bb7e5fc56
| Author: Bastien Guerry <bzg@altern.org>
| Date:   Tue Feb 15 06:07:53 2011 +0100
| 
|     Fix bug when jumping to a datetree from the agenda.
|     
|     Datetree entries have a fixed form now:
|     
|     * 2011
|     ** 2011-02 monthname
|     *** 2011-02-13 dayname
|     
|     These headings will not be recognized as datetrees:
|     
|     * 2011 A task for 2011
|     ** 2011-02 several words
|     *** 2011-02-13 several words
|     
|     Thanks to Detlef Steuer for reporting this.
`----

Regards,
Bernt

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

* Re: Date tree capture regexp for headline matching has changed.
  2011-05-10  1:03 ` Charles Cave
  2011-05-10  1:17   ` Bernt Hansen
@ 2011-05-10  1:34   ` Nick Dokos
  2011-05-10  1:58     ` Nick Dokos
  1 sibling, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2011-05-10  1:34 UTC (permalink / raw)
  To: Charles Cave; +Cc: nicholas.dokos, emacs-orgmode

Charles Cave <charles.cave@gmail.com> wrote:

> I compared org-datetre.el from 7.4 to 7.5 and got the following
> diff output (edited)
> 
> I can see that the regular expression has become more restricted
> with the addition of  \\w+$"  at the end.
> 
> At least I know what to manually change to make orgmode work the
> way I want it.
> 
> 
> 105c105   (this is the org-datetree-find-day-create function 
> 7.4: (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\)[ \t\n]" year month))
> ---
> 7.5: (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" year month))
> 
> 
> 
> 

Yes, but: there are two commits to org-datetree.el in the relevant time frame.

One was a fix in response to a bug report by you, so presumably
you want that fix - note that it touches the same regexp that you
identified above, but also note that there are similar regexps
that got modified in two other functions:


--8<---------------cut here---------------start------------->8---
commit a6554b2fdf40e8e76abf08f9a0364f0de75fa78b
Author: Bastien Guerry <bzg@altern.org>
Date:   Thu Feb 10 15:54:48 2011 +0100

    Fix bug when creating datetree heading.
    
    When a heading like
    
    * 2011 Do this
    
    existed, the creation of a datetree for the year 2011 didn't work,
    as the "2011 Do this" heading was mistaken for such a datetree.
    
    This has been reported by Charles Cave.

diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el
index 8014f8f..702b3a9 100644
--- a/lisp/org-datetree.el
+++ b/lisp/org-datetree.el
@@ -64,7 +64,7 @@ tree can be found."
       (goto-char (prog1 (point) (widen))))))
 
 (defun org-datetree-find-year-create (year)
-  (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t\n]")
+  (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]*$")
 	match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))
@@ -83,7 +83,7 @@ tree can be found."
 
 (defun org-datetree-find-month-create (year month)
   (org-narrow-to-subtree)
-  (let ((re (format "^\\*+[ \t]+%d-\\([01][0-9]\\)[ \t\n]" year))
+  (let ((re (format "^\\*+[ \t]+%d-\\([01][0-9]\\)[ \t]*$" year))
 	match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))
@@ -102,7 +102,7 @@ tree can be found."
 
 (defun org-datetree-find-day-create (year month day)
   (org-narrow-to-subtree)
-  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\)[ \t\n]" year month))
+  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\)[ \t]*$" year month))
 	match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))
--8<---------------cut here---------------end--------------->8---


The second commit is probably the one that broke your setup - note
that it too touches all three regexps, so if you fix one and not the
others, you are probably going to end up with an inconsistent code
base. If you use git to keep up to date, you'd be better off reverting
this commit in a private branch (see

  http://orgmode.org/worg/org-faq.html#keeping-local-changes-current-with-Org-mode-development

for information on how to keep current but still carry local changes):

--8<---------------cut here---------------start------------->8---
commit d9eeb15ab9d55316f08cd7efe818119bb7e5fc56
Author: Bastien Guerry <bzg@altern.org>
Date:   Tue Feb 15 06:07:53 2011 +0100

    Fix bug when jumping to a datetree from the agenda.
    
    Datetree entries have a fixed form now:
    
    * 2011
    ** 2011-02 monthname
    *** 2011-02-13 dayname
    
    These headings will not be recognized as datetrees:
    
    * 2011 A task for 2011
    ** 2011-02 several words
    *** 2011-02-13 several words
    
    Thanks to Detlef Steuer for reporting this.

diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el
index 702b3a9..f0f1b90 100644
--- a/lisp/org-datetree.el
+++ b/lisp/org-datetree.el
@@ -64,7 +64,7 @@ tree can be found."
       (goto-char (prog1 (point) (widen))))))
 
 (defun org-datetree-find-year-create (year)
-  (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]*$")
+  (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)$")
 	match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))
@@ -83,7 +83,7 @@ tree can be found."
 
 (defun org-datetree-find-month-create (year month)
   (org-narrow-to-subtree)
-  (let ((re (format "^\\*+[ \t]+%d-\\([01][0-9]\\)[ \t]*$" year))
+  (let ((re (format "^\\*+[ \t]+%d-\\([01][0-9]\\) \\w+$" year))
 	match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))
@@ -102,7 +102,7 @@ tree can be found."
 
 (defun org-datetree-find-day-create (year month day)
   (org-narrow-to-subtree)
-  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\)[ \t]*$" year month))
+  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" year month))
 	match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))
--8<---------------cut here---------------end--------------->8---


Nick

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

* Re: Date tree capture regexp for headline matching has changed.
  2011-05-10  1:34   ` Nick Dokos
@ 2011-05-10  1:58     ` Nick Dokos
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Dokos @ 2011-05-10  1:58 UTC (permalink / raw)
  Cc: emacs-orgmode, nicholas.dokos, Charles Cave

Nick Dokos <nicholas.dokos@hp.com> wrote:

> ... If you use git to keep up to date, you'd be better off reverting
> this commit in a private branch

Of course, that will expose you to the problem that Detlef ran into
which is discussed in the following thread[fn:1]:

  http://thread.gmane.org/gmane.emacs.orgmode/37663

Nick


Footnotes:

[fn:1]  Detlef mentions using the key sequence C-c a a i j
which I couldn't make work because I had the default setting
of org-agenda-diary-file. You need to set the latter to some
org file in order to make it work.

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

end of thread, other threads:[~2011-05-10  1:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-10  0:35 Date tree capture regexp for headline matching has changed Charles Cave
2011-05-10  1:03 ` Charles Cave
2011-05-10  1:17   ` Bernt Hansen
2011-05-10  1:34   ` Nick Dokos
2011-05-10  1:58     ` Nick Dokos

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