emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Charles Cave <charles.cave@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: Date tree capture regexp for headline matching has changed.
Date: Mon, 09 May 2011 21:34:57 -0400	[thread overview]
Message-ID: <6169.1304991297@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Charles Cave <charles.cave@gmail.com> of "Tue, 10 May 2011 01:03:05 -0000." <loom.20110510T025842-664@post.gmane.org>

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

  parent reply	other threads:[~2011-05-10  1:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-05-10  1:58     ` Nick Dokos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6169.1304991297@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=charles.cave@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).