[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Cut and paste an entry programmatically
From: |
Michael Brand |
Subject: |
[O] Cut and paste an entry programmatically |
Date: |
Thu, 16 May 2019 18:40:48 +0200 |
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
- [O] Cut and paste an entry programmatically,
Michael Brand <=