Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-01-16 22:27:24 +01:00
commit fe9e60d61b
2 changed files with 9 additions and 5 deletions

View File

@ -8888,14 +8888,15 @@ subtree has a repeater. Setting N to 0, then, can be used to
remove the repeater from a subtree and create a shifted clone
with the original repeater."
(interactive "nNumber of clones to produce: ")
(when (org-before-first-heading-p) (user-error "No subtree to clone"))
(let ((shift
(or shift
(if (and (not (equal current-prefix-arg '(4)))
(save-excursion
(re-search-forward org-ts-regexp-both
(save-excursion
(org-end-of-subtree t)
(point)) t)))
(org-back-to-heading t)
(re-search-forward
org-ts-regexp-both
(save-excursion (org-end-of-subtree t) (point)) t)))
(read-from-minibuffer
"Date shift per clone (e.g. +1w, empty to copy unchanged): ")
""))) ;; No time shift
@ -8917,7 +8918,6 @@ with the original repeater."
("m" . month) ("y" . year))))))
(when (eq shift-what 'week) (setq shift-n (* 7 shift-n) shift-what 'day))
(setq nmin 1 nmax n)
(org-back-to-heading t)
(setq beg (point))
(setq idprop (org-entry-get nil "ID"))
(org-end-of-subtree t t)

View File

@ -1324,6 +1324,10 @@
(ert-deftest test-org/clone-with-time-shift ()
"Test `org-clone-subtree-with-time-shift'."
;; Raise an error before first heading.
(should-error
(org-test-with-temp-text ""
(org-clone-subtree-with-time-shift 1)))
;; Clone non-repeating once.
(should
(equal "\