emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2021-02-24  4:27 Felipe Barros
  2021-02-24  4:51 ` Kyle Meyer
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Barros @ 2021-02-24  4:27 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 971 bytes --]

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

I have also tested with just 8 and with .+8h.

The documentation for org-clone-subtree-with-time-shift states that:

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

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.

Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.23)
of 2020-10-28
Package: Org mode version 9.3 (release_9.3 @ /usr/local/share/emacs/27.1/lisp/org/)

--
Felipe Barros

[-- Attachment #2: Type: text/html, Size: 1512 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 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/)]
  2021-02-24  4:27 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/)] Felipe Barros
@ 2021-02-24  4:51 ` Kyle Meyer
  2021-02-25  5:23   ` Kyle Meyer
  0 siblings, 1 reply; 3+ messages in thread
From: Kyle Meyer @ 2021-02-24  4:51 UTC (permalink / raw)
  To: Felipe Barros; +Cc: emacs-orgmode@gnu.org

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)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* 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/)]
  2021-02-24  4:51 ` Kyle Meyer
@ 2021-02-25  5:23   ` Kyle Meyer
  0 siblings, 0 replies; 3+ messages in thread
From: Kyle Meyer @ 2021-02-25  5:23 UTC (permalink / raw)
  To: Felipe Barros; +Cc: emacs-orgmode@gnu.org

Kyle Meyer writes:

> 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

Added tests and pushed (15c738545).


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-25  5:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-24  4:27 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/)] Felipe Barros
2021-02-24  4:51 ` Kyle Meyer
2021-02-25  5:23   ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).