diff options
author | Bastien Guerry <bzg@altern.org> | 2013-02-08 16:47:19 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2013-02-08 16:47:19 +0100 |
commit | 6bcd7c44ec12ea0f6d0da0f54f9ded46bd310637 (patch) | |
tree | fa3c16dc73a4ffb27905f71ceb861f744fe5ed46 | |
parent | 1af91246cf405794ecf341c4f991d9758a6ef006 (diff) | |
download | org-mode-6bcd7c44ec12ea0f6d0da0f54f9ded46bd310637.tar.gz |
org-agenda.el (org-agenda-write): Don't copy headlines' subtrees when writing to an .org file
* org-agenda.el (org-agenda-write): Don't copy headlines'
subtrees when writing to an .org file.
* org.el (org-copy-subtree): New parameter `nosubtrees'.
-rw-r--r-- | lisp/org-agenda.el | 2 | ||||
-rw-r--r-- | lisp/org.el | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 3039c35..6400550 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3334,7 +3334,7 @@ If AGENDA-BUFFER-NAME, use this as the buffer name for the agenda to write." (push (save-excursion (set-buffer (marker-buffer m)) (goto-char m) - (org-copy-subtree) + (org-copy-subtree 1 nil t t) org-subtree-clip) content))) (find-file file) diff --git a/lisp/org.el b/lisp/org.el index 4555ed1..4b649a0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7880,7 +7880,7 @@ This is a short-hand for marking the subtree and then cutting it." (interactive "p") (org-copy-subtree n 'cut)) -(defun org-copy-subtree (&optional n cut force-store-markers) +(defun org-copy-subtree (&optional n cut force-store-markers nosubtrees) "Cut the current subtree into the clipboard. With prefix arg N, cut this many sequential subtrees. This is a short-hand for marking the subtree and then copying it. @@ -7896,12 +7896,14 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut." (setq beg (point)) (skip-chars-forward " \t\r\n") (save-match-data - (save-excursion (outline-end-of-heading) - (setq folded (outline-invisible-p))) - (condition-case nil - (org-forward-heading-same-level (1- n) t) - (error nil)) - (org-end-of-subtree t t)) + (if nosubtrees + (outline-next-heading) + (save-excursion (outline-end-of-heading) + (setq folded (outline-invisible-p))) + (condition-case nil + (org-forward-heading-same-level (1- n) t) + (error nil)) + (org-end-of-subtree t t))) (setq end (point)) (goto-char beg0) (when (> end beg) |