瀏覽代碼

Fix task cloning for repeating tasks

* org.el (org-clone-subtree-with-time-shift): Fix task cloning for
repeating tasks using .+n and ++n syntax

Tasks with repeaters using .+n and ++n syntax retain the repeater in
all of the clones causing duplicate tasks.  These tasks are now
handled the same as the regular repeating task using +n syntax.
Bernt Hansen 13 年之前
父節點
當前提交
4a6e02c722
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      lisp/org.el

+ 3 - 3
lisp/org.el

@@ -7909,7 +7909,7 @@ the following will happen:
   repeater intact.
   repeater intact.
 - the start days in the repeater in the original entry will be shifted
 - the start days in the repeater in the original entry will be shifted
   to past the last clone.
   to past the last clone.
-I this way you can spell out a number of instances of a repeating task,
+In this way you can spell out a number of instances of a repeating task,
 and still retain the repeater to cover future instances of the task."
 and still retain the repeater to cover future instances of the task."
   (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ")
   (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ")
   (let (beg end template task idprop
   (let (beg end template task idprop
@@ -7936,7 +7936,7 @@ and still retain the repeater to cover future instances of the task."
     (setq end (point))
     (setq end (point))
     (setq template (buffer-substring beg end))
     (setq template (buffer-substring beg end))
     (when (and doshift
     (when (and doshift
-	       (string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template))
+	       (string-match "<[^<>\n]+ [.+]?\\+[0-9]+[dwmy][^<>\n]*>" template))
       (delete-region beg end)
       (delete-region beg end)
       (setq end beg)
       (setq end beg)
       (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
       (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
@@ -7967,7 +7967,7 @@ and still retain the repeater to cover future instances of the task."
 		(while (re-search-forward org-ts-regexp nil t)
 		(while (re-search-forward org-ts-regexp nil t)
 		  (save-excursion
 		  (save-excursion
 		    (goto-char (match-beginning 0))
 		    (goto-char (match-beginning 0))
-		    (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)")
+		    (if (looking-at "<[^<>\n]+\\( +[.+]?\\+[0-9]+[dwmy]\\)")
 			(delete-region (match-beginning 1) (match-end 1)))))))
 			(delete-region (match-beginning 1) (match-end 1)))))))
 	    (setq task (buffer-string)))
 	    (setq task (buffer-string)))
 	  (insert task))
 	  (insert task))