From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: Bug: org-clone-subtree-with-time-shift not asking for time-shift Date: Mon, 16 Jan 2017 12:56:01 -0500 Message-ID: <87h94yga8e.fsf@kyleam.com> References: <2017-01-16T12-42-31@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTBVq-0001We-2z for emacs-orgmode@gnu.org; Mon, 16 Jan 2017 12:56:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTBVm-0008I3-Vh for emacs-orgmode@gnu.org; Mon, 16 Jan 2017 12:56:10 -0500 Received: from pb-smtp2.pobox.com ([64.147.108.71]:50862 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cTBVm-0008Hs-OK for emacs-orgmode@gnu.org; Mon, 16 Jan 2017 12:56:06 -0500 In-Reply-To: <2017-01-16T12-42-31@devnull.Karl-Voit.at> (Karl Voit's message of "Mon, 16 Jan 2017 12:48:38 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Karl Voit Cc: Karl Voit , emacs-orgmode@gnu.org Karl Voit writes: > Hi! > > I wrote a blog article on how I am using Org with recurring events > or tasks: > http://karl-voit.at/2017/01/15/org-clone-subtree-with-time-shift/ > > As Michael Maurer stated in a comment below, > org-clone-subtree-with-time-shift does not ask for time-shift > depending on the location of the cursor. I think org-back-to-heading should be called before the timestamp search: --8<---------------cut here---------------start------------->8--- Subject: [PATCH] org-clone-subtree-with-time-shift: Fix timestamp search * lisp/org.el (org-clone-subtree-with-time-shift): Move to the beginning of the heading before the timestamp search so that the user will be prompted for a time shift even if point is after the timestamp. This also prevents an "Invalid search bound" error if point is on the blank line following a body-less heading: * single line <2017-02-28 Wed> Reported-by: Karl Voit --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 3c27f642a..f0ff80f68 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8976,6 +8976,7 @@ (defun org-clone-subtree-with-time-shift (n &optional shift) remove the repeater from a subtree and create a shifted clone with the original repeater." (interactive "nNumber of clones to produce: ") + (org-back-to-heading t) (let ((shift (or shift (if (and (not (equal current-prefix-arg '(4))) @@ -9005,7 +9006,6 @@ (defun org-clone-subtree-with-time-shift (n &optional shift) ("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) -- 2.11.0 --8<---------------cut here---------------end--------------->8--- -- Kyle