emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] copying a folded task expands when pasting


From: J. David Boyd
Subject: Re: [O] copying a folded task expands when pasting
Date: Thu, 17 Apr 2014 11:09:54 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Thorsten Jolitz <address@hidden> writes:

> 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

Thanks, I like the idea of moving to the end automatically and pasting it
folded.  That is great!

Dave




reply via email to

[Prev in Thread] Current Thread [Next in Thread]