[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: org-clone-subtree-with-time-shift not asking for time-shift

From: Kyle Meyer
Subject: Re: [O] Bug: org-clone-subtree-with-time-shift not asking for time-shift
Date: Mon, 16 Jan 2017 12:56:01 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Karl Voit <address@hidden> 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

--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

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>
    <point here>

Reported-by: Karl Voit <address@hidden>
 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 
 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 
                                     ("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)

--8<---------------cut here---------------end--------------->8---


reply via email to

[Prev in Thread] Current Thread [Next in Thread]