emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Cut and paste an entry programmatically
@ 2019-05-16 16:40 Michael Brand
  2019-05-17 10:16 ` Michael Brand
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michael Brand @ 2019-05-16 16:40 UTC (permalink / raw)
  To: Org Mode

Hi all

I would like to ask for some help to understand what am I doing wrong
with this minimal complete example:

#+begin_src org
,* 1
,* 2
,* 3
,* 4
#+end_src

#+begin_src emacs-lisp :results silent
  (defun temp ()
    (org-cut-subtree)
    (org-forward-heading-same-level 2)
    (org-paste-subtree))
#+end_src

When with point on 1 you do

    M-: (progn (save-excursion (temp)) (save-excursion (temp))) RET

the resulting buffer is the expected reordered 3, 1, 2, 4. When you do

    M-: (save-excursion (temp)) RET M-: (save-excursion (temp)) RET

the resulting buffer is 3, 1, 1, 2, 4 which is not what I want (Emacs
26.1 and today's Org mode master). Why is this and how to resolve?

Michael

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

end of thread, other threads:[~2019-06-29  7:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 16:40 Cut and paste an entry programmatically Michael Brand
2019-05-17 10:16 ` Michael Brand
2019-06-27 13:50 ` Fwd: " Michael Brand
2019-06-27 21:57 ` Samuel Wales
2019-06-28 11:07   ` Michael Brand
2019-06-29  0:58     ` Kyle Meyer
2019-06-29  7:27       ` Michael Brand

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