emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [feature] Cut & paste of subtree
@ 2012-10-31 11:06 Sebastien Vauban
  2012-10-31 15:42 ` Yagnesh Raghava Yakkala
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastien Vauban @ 2012-10-31 11:06 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

Since more or less one month or so, I've seen a change in the behavior of C-c
C-x C-w, when cutting and pasting a subtree.

As of today, with the following situation, I do C-c C-x C-w on whichever
character from the C entry.

--8<---------------cut here---------------start------------->8---
* Tree A

Foo

* Tree B

Bar

* Tree C

Baz

* Tree D

Dunno
--8<---------------cut here---------------end--------------->8---

Then, I go (for example) in column 0 of the B entry, and press C-y to paste
the previously cut subtree.

As you can see below, that results in:
- one whiteline too much in front of C,
- one whiteline missing after C (in front of B).

--8<---------------cut here---------------start------------->8---
* Tree A

Foo


* Tree C

Baz
* Tree B

Bar

* Tree D

Dunno
--8<---------------cut here---------------end--------------->8---

This is like if cutting the C subtree had cut from the end of the previous
subtree to its own end, instead of cutting from the beginning of its own
subtree to the beginning of the next one.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [feature] Cut & paste of subtree
  2012-10-31 11:06 [feature] Cut & paste of subtree Sebastien Vauban
@ 2012-10-31 15:42 ` Yagnesh Raghava Yakkala
  2012-11-01 12:20   ` Sebastien Vauban
  0 siblings, 1 reply; 5+ messages in thread
From: Yagnesh Raghava Yakkala @ 2012-10-31 15:42 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ




Hello Sebastien,

On 10月 31 2012, "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> wrote:

> Hello,
>
> Since more or less one month or so, I've seen a change in the behavior of C-c
> C-x C-w, when cutting and pasting a subtree.

I did know about this key binding, thanks for letting me know..

generally I go to the beginning of the heading I fold it and cut it., may be
work around for you..

coming the problem, I can confirm the behavior.

A shot in the dark.

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org.el b/lisp/org.el
index 63c4323..039e901 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7721,7 +7721,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
     (if (org-called-interactively-p 'any)
 	(org-back-to-heading nil) ; take what looks like a subtree
       (org-back-to-heading t)) ; take what is really there
-    (org-back-over-empty-lines)
     (setq beg (point))
     (skip-chars-forward " \t\r\n")
     (save-match-data
@@ -7731,7 +7730,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
 	  (org-forward-heading-same-level (1- n) t)
 	(error nil))
       (org-end-of-subtree t t))
-    (org-back-over-empty-lines)
     (setq end (point))
     (goto-char beg0)
     (when (> end beg)
--8<---------------cut here---------------end--------------->8---


Thanks.,
-- 
ఎందరో మహానుభావులు అందరికి వందనములు
YYR

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [feature] Cut & paste of subtree
  2012-10-31 15:42 ` Yagnesh Raghava Yakkala
@ 2012-11-01 12:20   ` Sebastien Vauban
  2012-11-01 13:19     ` Yagnesh Raghava Yakkala
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastien Vauban @ 2012-11-01 12:20 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Yagnesh,

Yagnesh Raghava Yakkala wrote:
> On 10月 31 2012, "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org> wrote:
>> Since more or less one month or so, I've seen a change in the behavior of C-c
>> C-x C-w, when cutting and pasting a subtree.
>
> I did know about this key binding, thanks for letting me know..
>
> generally I go to the beginning of the heading I fold it and cut it., may be
> work around for you..
>
> coming the problem, I can confirm the behavior.
>
> A shot in the dark.

I tested your patch. It does what it should -- thanks!

However, testing it with C-c C-x C-y (for pasting the subtree), I've
discovered there was a need to remove the same type of line in
org-paste-subtree.

The following patch does it all.

Thanks for your help.

From b644b0bd2aaf9c19c62d60b69702733e4999a11d Mon Sep 17 00:00:00 2001
From: Sebastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
Date: Thu, 1 Nov 2012 13:04:19 +0100
Subject: [PATCH] When pasting a copied subtree, respect the whitelines before
 and after

* org.el (org-copy-subtree, org-paste-subtree): Remove badly inserted
whitelines, when pasting a copied subtree.

---
 lisp/org.el |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 67e41e5..39e741b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7721,7 +7721,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
     (if (org-called-interactively-p 'any)
 	(org-back-to-heading nil) ; take what looks like a subtree
       (org-back-to-heading t)) ; take what is really there
-    (org-back-over-empty-lines)
     (setq beg (point))
     (skip-chars-forward " \t\r\n")
     (save-match-data
@@ -7731,7 +7730,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
 	  (org-forward-heading-same-level (1- n) t)
 	(error nil))
       (org-end-of-subtree t t))
-    (org-back-over-empty-lines)
     (setq end (point))
     (goto-char beg0)
     (when (> end beg)
@@ -7822,7 +7820,6 @@ the inserted text when done."
 	 (delete-region (point-at-bol) (point)))
      ;; Paste
      (beginning-of-line (if (bolp) 1 2))
-     (unless for-yank (org-back-over-empty-lines))
      (setq beg (point))
      (and (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt))
      (insert-before-markers txt)
--
1.7.9

Best regards,
  Seb

--
Sebastien Vauban

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [feature] Cut & paste of subtree
  2012-11-01 12:20   ` Sebastien Vauban
@ 2012-11-01 13:19     ` Yagnesh Raghava Yakkala
  2012-11-01 14:18       ` Sebastien Vauban
  0 siblings, 1 reply; 5+ messages in thread
From: Yagnesh Raghava Yakkala @ 2012-11-01 13:19 UTC (permalink / raw)
  To: emacs-orgmode


> However, testing it with C-c C-x C-y (for pasting the subtree)

or simply "C-y" ??

Thanks.,
-- 
ఎందరో మహానుభావులు అందరికి వందనములు
YYR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [feature] Cut & paste of subtree
  2012-11-01 13:19     ` Yagnesh Raghava Yakkala
@ 2012-11-01 14:18       ` Sebastien Vauban
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastien Vauban @ 2012-11-01 14:18 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Yagnesh,

Yagnesh Raghava Yakkala wrote:
>> However, testing it with C-c C-x C-y (for pasting the subtree)
>
> or simply "C-y" ??

With the above patch, _both_ C-y and C-c C-x C-y now work as expected.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-11-01 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-31 11:06 [feature] Cut & paste of subtree Sebastien Vauban
2012-10-31 15:42 ` Yagnesh Raghava Yakkala
2012-11-01 12:20   ` Sebastien Vauban
2012-11-01 13:19     ` Yagnesh Raghava Yakkala
2012-11-01 14:18       ` Sebastien Vauban

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