emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Bug: org-clone-subtree-with-time-shift invalid interval when using h


From: Kyle Meyer
Subject: Re: Bug: org-clone-subtree-with-time-shift invalid interval when using hours [9.3 (release_9.3 @ /usr/local/share/emacs/27.1/lisp/org/)]
Date: Tue, 23 Feb 2021 23:51:59 -0500

Felipe Barros writes:

> Running org-clone-subtree-with-time-shift and entering an hourly
> interval returns an error that the shift specification is invalid.
>
> For example, entering +8h returns:
>
> user-error: Invalid shift specification +8h
[...]
> And the Info page for Repeated Tasks states that:
>
>> You can use yearly, monthly, weekly, daily and hourly repeat cookies
>> by using the ‘y’, ‘w’, ‘m’, ‘d’ and ‘h’ letters.
>
> So, as I couldn’t find a reference to this limitation anywhere, I
> believe this is a valid bug.

I'm guessing h was left off for this command because it didn't seem too
useful.  But something like below should work (untested), and I don't
see any particular reason to not support h.

diff --git a/lisp/org.el b/lisp/org.el
index 7d8733448..00596564f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7906,7 +7906,7 @@ (defun org-clone-subtree-with-time-shift (n &optional 
shift)
                "")))                   ;No time shift
         (doshift
          (and (org-string-nw-p shift)
-              (or (string-match "\\`[ \t]*\\([+-]?[0-9]+\\)\\([dwmy]\\)[ 
\t]*\\'"
+              (or (string-match "\\`[ \t]*\\([+-]?[0-9]+\\)\\([hdwmy]\\)[ 
\t]*\\'"
                                 shift)
                   (user-error "Invalid shift specification %s" shift)))))
     (goto-char end-of-tree)
@@ -7916,6 +7916,7 @@ (defun org-clone-subtree-with-time-shift (n &optional 
shift)
           (shift-n (and doshift (string-to-number (match-string 1 shift))))
           (shift-what (pcase (and doshift (match-string 2 shift))
                         (`nil nil)
+                        ("h" 'hour)
                         ("d" 'day)
                         ("w" (setq shift-n (* 7 shift-n)) 'day)
                         ("m" 'month)



reply via email to

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