mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-26 18:00:53 +00:00
Allow cloning subtrees while shifting them backward in time
* lisp/org.el (org-clone-subtree-with-time-shift): Accept a negative value to shift the timestamp backward in time. * testing/lisp/test-org.el (test-org/clone-with-time-shift): Add test. Reported-by: Scott Randby <srandby@gmail.com> <http://lists.gnu.org/r/emacs-orgmode/2019-01/msg00151.html> Signed-off-by: Yasushi SHOJI <yasushi.shoji@gmail.com>
This commit is contained in:
parent
c7e306d665
commit
4a076ed545
|
@ -104,6 +104,11 @@ A 'native option was added to org-highlight-latex-and-related. It
|
||||||
matches the same structures than 'latex but it calls
|
matches the same structures than 'latex but it calls
|
||||||
org-src-font-lock-fontify-block instead, thus bringing about full
|
org-src-font-lock-fontify-block instead, thus bringing about full
|
||||||
LaTeX font locking.
|
LaTeX font locking.
|
||||||
|
*** ~org-clone-subtree-with-time-shift~ learnt to shift backward in time
|
||||||
|
=<C-c C-x c>= (~org-clone-subtree-with-time-shift~) now takes a
|
||||||
|
negative value as a valid repeater to shift time stamps in backward
|
||||||
|
in cloned subtrees. You can give, for example, ‘-3d’ to shift three
|
||||||
|
days in the past.
|
||||||
|
|
||||||
** New functions
|
** New functions
|
||||||
*** ~org-dynamic-block-insert-dblock~
|
*** ~org-dynamic-block-insert-dblock~
|
||||||
|
|
|
@ -8452,7 +8452,7 @@ with the original repeater."
|
||||||
""))) ;No time shift
|
""))) ;No time shift
|
||||||
(doshift
|
(doshift
|
||||||
(and (org-string-nw-p shift)
|
(and (org-string-nw-p shift)
|
||||||
(or (string-match "\\`[ \t]*\\+?\\([0-9]+\\)\\([dwmy]\\)[ \t]*\\'"
|
(or (string-match "\\`[ \t]*\\([\\+\\-]?[0-9]+\\)\\([dwmy]\\)[ \t]*\\'"
|
||||||
shift)
|
shift)
|
||||||
(user-error "Invalid shift specification %s" shift)))))
|
(user-error "Invalid shift specification %s" shift)))))
|
||||||
(goto-char end-of-tree)
|
(goto-char end-of-tree)
|
||||||
|
|
|
@ -1496,6 +1496,18 @@
|
||||||
(replace-regexp-in-string
|
(replace-regexp-in-string
|
||||||
"\\( [.A-Za-z]+\\)\\( \\+[0-9][hdmwy]\\)?>" "" (buffer-string)
|
"\\( [.A-Za-z]+\\)\\( \\+[0-9][hdmwy]\\)?>" "" (buffer-string)
|
||||||
nil nil 1))))
|
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.
|
;; Clone non-repeating zero times.
|
||||||
(should
|
(should
|
||||||
(equal "\
|
(equal "\
|
||||||
|
|
Loading…
Reference in a new issue