org.el (org-clone-subtree-with-time-shift): Don't prompt for a time shift by default

* org.el (org-clone-subtree-with-time-shift): Only prompt for
a time shift when the entry at point has a time stamp and when
the command is called with a universal prefix argument.
This commit is contained in:
Bastien Guerry 2013-03-15 13:13:14 +01:00
parent 72bb08f0b8
commit ad95f19be1
1 changed files with 20 additions and 6 deletions

View File

@ -8281,8 +8281,10 @@ If yes, remember the marker and the distance to BEG."
The clones will be inserted as siblings. The clones will be inserted as siblings.
In interactive use, the user will be prompted for the number of In interactive use, the user will be prompted for the number of
clones to be produced, and for a time SHIFT, which may be a clones to be produced. When called with a universal prefix argument
repeater as used in time stamps, for example `+3d'. and if the entry has a timestamp, the user will also be prompted for
a time shift, which may be a repeater as used in time stamps, for
example `+3d'.
When a valid repeater is given and the entry contains any time When a valid repeater is given and the entry contains any time
stamps, the clones will become a sequence in time, with time stamps, the clones will become a sequence in time, with time
@ -8301,10 +8303,22 @@ the following will happen:
to past the last clone. to past the last clone.
In 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: ")
(let (beg end template task idprop (let ((shift
shift-n shift-what doshift nmin nmax (n-no-remove -1) (or shift
(drawer-re org-drawer-regexp)) (if (and (equal current-prefix-arg '(4))
(save-excursion
(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
(n-no-remove -1)
(drawer-re org-drawer-regexp)
beg end template task idprop
shift-n shift-what doshift nmin nmax)
(if (not (and (integerp n) (> n 0))) (if (not (and (integerp n) (> n 0)))
(error "Invalid number of replications %s" n)) (error "Invalid number of replications %s" n))
(if (and (setq doshift (and (stringp shift) (string-match "\\S-" shift))) (if (and (setq doshift (and (stringp shift) (string-match "\\S-" shift)))