Browse Source

Rebuild agenda after adding new diary entries

Carsten Dominik 15 years ago
parent
commit
e80f24641c
3 changed files with 13 additions and 4 deletions
  1. 6 0
      lisp/ChangeLog
  2. 6 3
      lisp/org-agenda.el
  3. 1 1
      lisp/org-datetree.el

+ 6 - 0
lisp/ChangeLog

@@ -1,5 +1,11 @@
 2009-11-20  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-agenda.el (org-agenda-diary-entry-in-org-file): Rebuild
+	agenda after adding new entry.
+
+	* org-datetree.el (org-datetree-find-day-create): Fix regular
+	expression.
+
 	* org.el (org-display-outline-path): Use a format specifier for
 	message, to avoid problems with heading containing `%'.
 

+ 6 - 3
lisp/org-agenda.el

@@ -6701,18 +6701,21 @@ The cursor may be at a date in the calendar, or in the Org agenda."
     (cond
      ((equal char ?d)
       (setq text (read-string "Day entry: "))
-      (org-agenda-add-entry-to-org-agenda-diary-file 'day text d1))
+      (org-agenda-add-entry-to-org-agenda-diary-file 'day text d1)
+      (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
      ((equal char ?a)
       (setq d1 (list (car d1) (nth 1 d1)
 		     (read-number (format "Reference year [%d]: " (nth 2 d1))
 				  (nth 2 d1))))
       (setq text (read-string "Anniversary (use %d to show years): "))
-      (org-agenda-add-entry-to-org-agenda-diary-file 'anniversary text d1))
+      (org-agenda-add-entry-to-org-agenda-diary-file 'anniversary text d1)
+      (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
      ((equal char ?b)
       (setq text (read-string "Block entry: "))
       (unless (and d1 d2 (not (equal d1 d2)))
 	(error "No block of days selected"))
-      (org-agenda-add-entry-to-org-agenda-diary-file 'block text d1 d2))
+      (org-agenda-add-entry-to-org-agenda-diary-file 'block text d1 d2)
+      (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
      ((equal char ?j)
       (org-switch-to-buffer-other-window
        (find-file-noselect org-agenda-diary-file))

+ 1 - 1
lisp/org-datetree.el

@@ -101,7 +101,7 @@ tree can be found."
 
 (defun org-datetree-find-day-create (year month day)
   (org-narrow-to-subtree)
-  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([01][0-9]\\)[ \t\n]" year month))
+  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\)[ \t\n]" year month))
 	match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))