* 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