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'.
This commit is contained in:
Bastien Guerry 2013-02-08 16:47:19 +01:00
parent 1af91246cf
commit 6bcd7c44ec
2 changed files with 10 additions and 8 deletions

View File

@ -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)

View File

@ -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)