summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-04-18 12:20:08 +0200
committerBastien Guerry <bzg@altern.org>2013-04-18 12:20:08 +0200
commitccdfa8ddf8c1e7ae438a3f3df6927f1026baf5c0 (patch)
tree42dabda8e5a279e7b742a8521dfe0c29c08725bd
parentb432d2eb93a7277de765434d87eda9237e540826 (diff)
downloadorg-mode-ccdfa8ddf8c1e7ae438a3f3df6927f1026baf5c0.tar.gz
org-datetree.el: Be more restrictive when finding a year datetree
* org-datetree.el (org-datetree-find-month-create) (org-datetree-find-day-create): Add a docstring. (org-datetree-find-year-create): Only match headlines with a year or a year and one or more tags. Thanks to Suvayu Ali for reporting this.
-rw-r--r--lisp/org-datetree.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el
index e0f4d10..dd4b1b0 100644
--- a/lisp/org-datetree.el
+++ b/lisp/org-datetree.el
@@ -72,7 +72,8 @@ tree can be found."
(goto-char (prog1 (point) (widen))))))
(defun org-datetree-find-year-create (year)
- (let ((re "^\\*+[ \t]+\\([12][0-9]\\{3\\}\\)\\(.*?\\([ \t]:[[:alnum:]:_@#%]+:\\)?\\s-*$\\)")
+ "Find the YEAR datetree or create it."
+ (let ((re "^\\*+[ \t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\\([ \t]:[[:alnum:]:_@#%]+:\\)?\\s-*$\\)")
match)
(goto-char (point-min))
(while (and (setq match (re-search-forward re nil t))
@@ -90,6 +91,7 @@ tree can be found."
(org-datetree-insert-line year)))))
(defun org-datetree-find-month-create (year month)
+ "Find the datetree for YEAR and MONTH or create it."
(org-narrow-to-subtree)
(let ((re (format "^\\*+[ \t]+%d-\\([01][0-9]\\) \\w+$" year))
match)
@@ -109,6 +111,7 @@ tree can be found."
(org-datetree-insert-line year month)))))
(defun org-datetree-find-day-create (year month day)
+ "Find the datetree for YEAR, MONTH and DAY or create it."
(org-narrow-to-subtree)
(let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" year month))
match)