[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] copying a folded task expands when pasting
From: |
Thorsten Jolitz |
Subject: |
Re: [O] copying a folded task expands when pasting |
Date: |
Thu, 17 Apr 2014 15:59:54 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
address@hidden (J. David Boyd) writes:
> Is there anyway to turn this off.
>
> I keep my tasks folded, mostly, except for the current one I am working on.
>
> Prior to archiving, when I've marked them DONE, I move them to the
> bottom of
> the file they are in.
>
> So, I C-w on a folded DONE task, move to the bottom of the file, and
> S-Ins to
> place it there. But every time it unfolds it, leaving the point at
> the bottom
> of the entry. Then I need to move back up and refold it.
>
> Minor point yes, but it's the way I like to work.
>
> So, I haven't found any setting that relates to folding/unfolding on
> cut and
> paste.
>
> Am I missing something, or is that just the way it works?
As always, it might already exist in Org-mode/Emacs, but its easy to
implement anyway:
#+begin_src emacs-lisp
(defun tj/yank-folded-subtree ()
(interactive)
(save-excursion
(yank '(4))
(hide-subtree)))
#+end_src
#+results:
: tj/yank-folded-subtree
or a bit more convenient:
#+begin_src emacs-lisp
(defun tj/kill-and-append-folded-subtree ()
"Kill subtree at point and yank it folded at EOB."
(interactive)
(save-excursion
(org-mark-subtree)
(when (use-region-p)
(kill-region (region-beginning) (region-end)))
(goto-char (point-max))
(unless (looking-at "^$") (newline))
(yank '(4))
(hide-subtree)))
#+end_src
#+results:
: tj/kill-and-append-folded-subtree
---
cheers,
Thorsten