From: Yasushi SHOJI <yasushi.shoji@gmail.com>
To: Scott Randby <srandby@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: Clone tree backwards in time
Date: Mon, 14 Jan 2019 10:23:47 +0900 [thread overview]
Message-ID: <CAELBRWLVbucYOshEa-wrAgLxcKhh1dCiJF677Z_mZTyecfinqA@mail.gmail.com> (raw)
In-Reply-To: <bc53c502-951b-a646-e9b0-9cf47d20c8d7@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 293 bytes --]
Hi,
On Thu, Jan 10, 2019 at 1:28 PM Scott Randby <srandby@gmail.com> wrote:
> On occasion, I need to clone a tree backwards in time. I tried using something like -2d (instead of the usual +2d) without success. Is there a way to clone backwards in time?
How about this?
--
yashi
[-- Attachment #2: 0001-clone-Allow-time-shift-in-backward.patch --]
[-- Type: text/x-patch, Size: 1678 bytes --]
From 5d421e09f80dde295bbd4541059f5d432dce2c59 Mon Sep 17 00:00:00 2001
From: Yasushi SHOJI <yasushi.shoji@gmail.com>
Date: Mon, 14 Jan 2019 10:19:50 +0900
Subject: [PATCH] clone: Allow time shift in backward
Make org-clone-subtree-with-time-shift accept a negative value to
shift the timestamp in backward.
---
lisp/org.el | 2 +-
testing/lisp/test-org.el | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lisp/org.el b/lisp/org.el
index 0b090ee39..19b1946a0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8451,7 +8451,7 @@ with the original repeater."
""))) ;No time shift
(doshift
(and (org-string-nw-p shift)
- (or (string-match "\\`[ \t]*\\+?\\([0-9]+\\)\\([dwmy]\\)[ \t]*\\'"
+ (or (string-match "\\`[ \t]*\\([\\+\\-]?[0-9]+\\)\\([dwmy]\\)[ \t]*\\'"
shift)
(user-error "Invalid shift specification %s" shift)))))
(goto-char end-of-tree)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 976b7d8d6..db34a03c2 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -1496,6 +1496,18 @@
(replace-regexp-in-string
"\\( [.A-Za-z]+\\)\\( \\+[0-9][hdmwy]\\)?>" "" (buffer-string)
nil nil 1))))
+ ;; Clone repeating once in backward.
+ (should
+ (equal "\
+* H1\n<2015-06-21>
+* H1\n<2015-06-19>
+* H1\n<2015-06-17 +1w>
+"
+ (org-test-with-temp-text "* H1\n<2015-06-21 Sun +1w>"
+ (org-clone-subtree-with-time-shift 1 "-2d")
+ (replace-regexp-in-string
+ "\\( [.A-Za-z]+\\)\\( \\+[0-9][hdmwy]\\)?>" "" (buffer-string)
+ nil nil 1))))
;; Clone non-repeating zero times.
(should
(equal "\
--
2.20.1
next prev parent reply other threads:[~2019-01-14 1:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 4:26 Clone tree backwards in time Scott Randby
2019-01-14 1:23 ` Yasushi SHOJI [this message]
2019-01-15 19:05 ` Scott Randby
2019-01-16 14:06 ` Yasushi SHOJI
2019-01-18 17:56 ` Nicolas Goaziou
2019-01-21 9:09 ` Yasushi SHOJI
2019-01-21 17:49 ` Nicolas Goaziou
2019-01-21 18:02 ` Scott Randby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAELBRWLVbucYOshEa-wrAgLxcKhh1dCiJF677Z_mZTyecfinqA@mail.gmail.com \
--to=yasushi.shoji@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=srandby@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).