浏览代码

Agenda: Allow to find multiple same-day time stamps in one entry

Tassilo Horn writes:

>  I have this entry in an org-file.
>
>  --8<---------------cut here---------------start------------->8---
>  ** bung Grundlagen der Softwaretechnik (B 016)        :teaching:
>    <2009-04-22 Wed 08:30-10:00 +1w>
>    <2009-04-29 Wed 10:15-11:45> (Fr Hannes bernehmen)
>  --8<---------------cut here---------------end--------------->8---
>
>  I expect it to be displayed every wednesday after 2009-04-22
>  for 08:30-10:00 and on 2009-04-29 it should be displayed
>  twice: one at the usual time and one for 10:15-11:45.
>
>  But the agenda shows only the regular entry (08:30-10:00)
>  and omitts the exception.  If I reorder the timestamps, so
>  that the exception comes first, only the exception will be
>  shown on 2009-04-29.  Every other wednesday shows the
>  regular repeater date.
>
>  What do I have to do to make that entry showing up twice on
>  29th April?

This commit adds a new option
`org-agenda-skip-additional-timestamps-same-entry'.  When set
to t, an entry that has multiple active time stamps will get
multiple lines in the agenda.
Carsten Dominik 16 年之前
父节点
当前提交
10cc01f7e7
共有 2 个文件被更改,包括 17 次插入3 次删除
  1. 5 0
      lisp/ChangeLog
  2. 12 3
      lisp/org-agenda.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2009-04-22  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-04-22  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
+	* org-agenda.el (org-agenda-skip-additional-timestamps-same-entry):
+	New option.
+	(org-agenda-get-timestamps): Honor
+	`org-agenda-skip-additional-timestamps-same-entry'.
+
 	* org-clock.el (org-clock-goto-may-find-recent-task): New option.
 	* org-clock.el (org-clock-goto-may-find-recent-task): New option.
 	(org-clock-goto): Find recent task only if
 	(org-clock-goto): Find recent task only if
 	`org-clock-goto-may-find-recent-task' allows it.
 	`org-clock-goto-may-find-recent-task' allows it.

+ 12 - 3
lisp/org-agenda.el

@@ -556,6 +556,13 @@ deadlines are always turned off when the item is DONE."
   :group 'org-agenda-daily/weekly
   :group 'org-agenda-daily/weekly
   :type 'boolean)
   :type 'boolean)
 
 
+(defcustom org-agenda-skip-additional-timestamps-same-entry t
+  "When nil, multiple same-day timestamps in entry make multiple agenda lines.
+When non-nil, after the search for timestamps has matched once in an
+entry, the rest of the entry will not be searched."
+  :group 'org-agenda-skip
+  :type 'boolean)
+
 (defcustom org-agenda-skip-timestamp-if-done nil
 (defcustom org-agenda-skip-timestamp-if-done nil
   "Non-nil means don't select item by timestamp or -range if it is DONE."
   "Non-nil means don't select item by timestamp or -range if it is DONE."
   :group 'org-agenda-skip
   :group 'org-agenda-skip
@@ -3671,9 +3678,9 @@ the documentation of `org-diary'."
 	   "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
 	   "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
 	 marker hdmarker deadlinep scheduledp clockp closedp inactivep
 	 marker hdmarker deadlinep scheduledp clockp closedp inactivep
 	 donep tmp priority category ee txt timestr tags b0 b3 e3 head
 	 donep tmp priority category ee txt timestr tags b0 b3 e3 head
-	 todo-state)
+	 todo-state end-of-match)
     (goto-char (point-min))
     (goto-char (point-min))
-    (while (re-search-forward regexp nil t)
+    (while (setq end-of-match (re-search-forward regexp nil t))
       (setq b0 (match-beginning 0)
       (setq b0 (match-beginning 0)
 	    b3 (match-beginning 3) e3 (match-end 3))
 	    b3 (match-beginning 3) e3 (match-end 3))
       (catch :skip
       (catch :skip
@@ -3730,7 +3737,9 @@ the documentation of `org-diary'."
 			 'todo-state todo-state
 			 'todo-state todo-state
 			 'type "timestamp")
 			 'type "timestamp")
 	  (push txt ee))
 	  (push txt ee))
-	(outline-next-heading)))
+	(if org-agenda-skip-additional-timestamps-same-entry
+	    (outline-next-heading)
+	  (goto-char end-of-match))))
     (nreverse ee)))
     (nreverse ee)))
 
 
 (defun org-agenda-get-sexps ()
 (defun org-agenda-get-sexps ()