From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Samuel Wales" Subject: Re: feature request: org-yank to call org-paste-subtree Date: Sun, 26 Oct 2008 01:35:48 -0700 Message-ID: <20524da70810260135v1adc1022le89e4ba6d9eeab6a@mail.gmail.com> References: <20524da70810252137k1545b20bobbf162360dc251ad@mail.gmail.com> <973CD8B2-1E07-457E-BA70-16F3EAFE892C@uva.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ku16F-0002uY-W5 for emacs-orgmode@gnu.org; Sun, 26 Oct 2008 04:35:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ku16F-0002tZ-9C for emacs-orgmode@gnu.org; Sun, 26 Oct 2008 04:35:51 -0400 Received: from [199.232.76.173] (port=36385 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ku16F-0002tI-4Z for emacs-orgmode@gnu.org; Sun, 26 Oct 2008 04:35:51 -0400 Received: from ey-out-1920.google.com ([74.125.78.148]:52388) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ku16E-000728-Da for emacs-orgmode@gnu.org; Sun, 26 Oct 2008 04:35:50 -0400 Received: by ey-out-1920.google.com with SMTP id 4so694856eyg.24 for ; Sun, 26 Oct 2008 01:35:48 -0700 (PDT) In-Reply-To: <973CD8B2-1E07-457E-BA70-16F3EAFE892C@uva.nl> Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org I find that org-paste-subtree works perfectly all the time for headlines, and that org-yank does not work for headlines any time the levels are wrong. But I just started using them. Approximate and prob wrong: (defun org-yank-possibly-adjusted () (save-excursion (if (and org-yank-adjust (org-kill-is-subtree-p)) (call-interactively 'org-paste-subtree) (call-interactively 'yank)))) (defun org-yank () "Yank, and if the yanked text is a single subtree, fold it. In fact, if the yanked text is a sequence of subtrees, fold all of them." (interactive) (if org-yank-folded-subtrees (let ((beg (point)) end) (org-yank-possibly-adjusted) ...