summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2011-07-09 15:04:39 +0200
committerBastien Guerry <bzg@altern.org>2011-07-09 15:04:39 +0200
commit516b2fbb8763788585ac6a9f60ad7d51c4b0aab3 (patch)
tree144e7dab286c38e499a0b6f82f7395b71c5d5c5b
parent3178cf4afa88e4a1227f6dd0c88a221208b2e82a (diff)
downloadorg-mode-516b2fbb8763788585ac6a9f60ad7d51c4b0aab3.tar.gz
org.el: remove CLOCK: and empty drawers from clones.
-rw-r--r--lisp/org.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 0b1434a..515a647 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7718,6 +7718,19 @@ and still retain the repeater to cover future instances of the task."
(or (bolp) (insert "\n"))
(setq end (point))
(setq template (buffer-substring beg end))
+ ;; Remove clocks and empty drawers
+ (with-temp-buffer
+ (insert template)
+ (goto-char (point-min))
+ (while (re-search-forward
+ "^[ \t]*CLOCK:.*$" (save-excursion (org-end-of-subtree t t)) t)
+ (replace-match "")
+ (kill-whole-line))
+ (goto-char (point-min))
+ (while (re-search-forward
+ (concat "^[ \t]*:" (regexp-opt org-drawers) ":[ \t]*$") nil t)
+ (mapc (lambda(d) (org-remove-empty-drawer-at d (point))) org-drawers))
+ (setq template (buffer-substring (point-min) (point-max))))
(when (and doshift
(string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template))
(delete-region beg end)