emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: jdavidboyd@adboyd.com (J. David Boyd)
To: emacs-orgmode@gnu.org
Subject: Re: copying a folded task expands when pasting
Date: Thu, 17 Apr 2014 11:09:54 -0400	[thread overview]
Message-ID: <e0tczjjkrnzx.fsf@www1.g9.pair.com> (raw)
In-Reply-To: 87tx9scazp.fsf@gmail.com

Thorsten Jolitz <tjolitz@gmail.com> writes:

> jdavidboyd@adboyd.com (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	other threads:[~2014-04-17 15:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17 12:57 copying a folded task expands when pasting J. David Boyd
2014-04-17 13:59 ` Thorsten Jolitz
2014-04-17 15:09   ` J. David Boyd [this message]
2014-04-17 14:44 ` Bastien
2014-04-17 15:12   ` J. David Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0tczjjkrnzx.fsf@www1.g9.pair.com \
    --to=jdavidboyd@adboyd.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).