emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* move org line to next superior level
@ 2014-05-29  3:57 Uwe Ziegenhagen
  2014-05-29 14:28 ` Thorsten Jolitz
  2014-05-29 17:29 ` Bastien
  0 siblings, 2 replies; 8+ messages in thread
From: Uwe Ziegenhagen @ 2014-05-29  3:57 UTC (permalink / raw)
  To: emacs-orgmode

Hi everyone,

is there a way to move a specific org mode item across its superior level
via shortcut?

In the following example I'd like to move the "cccc" line via shortcut below
the 'bbbb' line.

* aaa
** TODO cccc
* bbb
** TODO dddd

As addon it would be cool to flag this moved line with e.g. "moved on
2014-05-29"

What I trying to accomplish here is to create a kind of electronic version
of 43folders. When I am not able to finish a task on say Monday, I'd like to
be able to move it (or alternatively copy it [while setting the original
entry's status to "postponed"]) to the next day.


Uwe

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

* Re: move org line to next superior level
  2014-05-29  3:57 move org line to next superior level Uwe Ziegenhagen
@ 2014-05-29 14:28 ` Thorsten Jolitz
  2014-05-29 15:12   ` Eric Abrahamsen
  2014-05-29 18:15   ` Uwe Ziegenhagen
  2014-05-29 17:29 ` Bastien
  1 sibling, 2 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-05-29 14:28 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Ziegenhagen <ziegenhagen@gmail.com> writes:

Hi,

> is there a way to move a specific org mode item across its superior level
> via shortcut?
>
> In the following example I'd like to move the "cccc" line via shortcut
> below
> the 'bbbb' line.
>
> * aaa
> ** TODO cccc
> * bbb
> ** TODO dddd
>
> As addon it would be cool to flag this moved line with e.g. "moved on
> 2014-05-29"
>
> What I trying to accomplish here is to create a kind of electronic version
> of 43folders. When I am not able to finish a task on say Monday, I'd
> like to
> be able to move it (or alternatively copy it [while setting the original
> entry's status to "postponed"]) to the next day.

Isn't it a feature of Org-mode that tasks can be added anywhere without
giving a thought in the agenda files, letting the agenda itself sort
them by date? Just changing the timestamp from monday to tuesday would
do the job in a normal workflow, making the agenda-file structuring by
day redundant.

Otherwise what you want would be pretty easy to implement with Orgs
basic structure editing and navigation functions, e.g.

#+begin_src emacs-lisp
  (defun tj/move-entry-to-next-day ()
    "Move entry at point to next parent and tag it."
    (unless (org-on-heading-p)
      (outline-previous-heading))
    (org-mark-subtree)
    (kill-region (region-beginning) (region-end))
    (org-up-heading-safe)
    (org-forward-heading-same-level 1)
    (forward-line)
    (yank)
    (outline-previous-heading)
    (org-mark-subtree)
    (org-change-tag-in-region 
     (region-beginning) (region-end) "postponed" nil))
#+end_src

This works with you example Org snippet, but is not tested otherwise. 

-- 
cheers,
Thorsten

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

* Re: move org line to next superior level
  2014-05-29 14:28 ` Thorsten Jolitz
@ 2014-05-29 15:12   ` Eric Abrahamsen
  2014-05-29 17:16     ` Uwe Ziegenhagen
  2014-05-29 18:15   ` Uwe Ziegenhagen
  1 sibling, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2014-05-29 15:12 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Uwe Ziegenhagen <ziegenhagen@gmail.com> writes:
>
> Hi,
>
>> is there a way to move a specific org mode item across its superior level
>> via shortcut?
>>
>> In the following example I'd like to move the "cccc" line via shortcut
>> below
>> the 'bbbb' line.
>>
>> * aaa
>> ** TODO cccc
>> * bbb
>> ** TODO dddd
>>
>> As addon it would be cool to flag this moved line with e.g. "moved on
>> 2014-05-29"
>>
>> What I trying to accomplish here is to create a kind of electronic version
>> of 43folders. When I am not able to finish a task on say Monday, I'd
>> like to
>> be able to move it (or alternatively copy it [while setting the original
>> entry's status to "postponed"]) to the next day.
>
> Isn't it a feature of Org-mode that tasks can be added anywhere without
> giving a thought in the agenda files, letting the agenda itself sort
> them by date? Just changing the timestamp from monday to tuesday would
> do the job in a normal workflow, making the agenda-file structuring by
> day redundant.

It's worth thinking about this point. There's a moment of freedom that
comes when you allow yourself to just dump headings into a file
willy-nilly, and *only* pick them out and examine them with the agenda.
It's a bit of a leap of faith, but I have to say it's very freeing when
you take it. 

Some files are for writing novels in, and you'll want to pore over their
every line. Other files should never be looked at. You put lines in with
org-capture, and you take lines out with org-agenda. That's all they're
for.

E

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

* Re: move org line to next superior level
  2014-05-29 15:12   ` Eric Abrahamsen
@ 2014-05-29 17:16     ` Uwe Ziegenhagen
  2014-05-29 18:03       ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Ziegenhagen @ 2014-05-29 17:16 UTC (permalink / raw)
  To: emacs-orgmode

Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:

> 
> Thorsten Jolitz <tjolitz <at> gmail.com> writes:
> 
> >
> > Isn't it a feature of Org-mode that tasks can be added anywhere without
> > giving a thought in the agenda files, letting the agenda itself sort
> > them by date? Just changing the timestamp from monday to tuesday would
> > do the job in a normal workflow, making the agenda-file structuring by
> > day redundant.

The way that I currently use Org Mode is the following

On level 1 I have all the weeks, on level 2 the tasks

* 2014-05-26--2014-06-01
** TODO [#C] Python Test

I know org mode offers way more functionalities, but right now I am
exploring the basics.

Thanks for the help

Uwe

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

* Re: move org line to next superior level
  2014-05-29  3:57 move org line to next superior level Uwe Ziegenhagen
  2014-05-29 14:28 ` Thorsten Jolitz
@ 2014-05-29 17:29 ` Bastien
  1 sibling, 0 replies; 8+ messages in thread
From: Bastien @ 2014-05-29 17:29 UTC (permalink / raw)
  To: Uwe Ziegenhagen; +Cc: emacs-orgmode

Hi Uwe,

Uwe Ziegenhagen <ziegenhagen@gmail.com> writes:

> In the following example I'd like to move the "cccc" line via shortcut below
> the 'bbbb' line.
>
> * aaa
> ** TODO cccc
> * bbb
> ** TODO dddd

With current version (from maint):

- put your cursor on ** TODO cccc
- C-a to go at the beginning of the line
- C-SPC to activate the mark
- C-n to go one line down
- M-<down> to transpose the lines

With latest master:

- put your cursor on ** TODO cccc
- hit S-M-<up> to drag the line down

> As addon it would be cool to flag this moved line with e.g. "moved on
> 2014-05-29"

In latest master, you can add a function in `org-shiftmetadown-hook'
that would use `org-set-property' to add this.

HTH,

-- 
 Bastien

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

* Re: move org line to next superior level
  2014-05-29 17:16     ` Uwe Ziegenhagen
@ 2014-05-29 18:03       ` Thorsten Jolitz
  0 siblings, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-05-29 18:03 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Ziegenhagen <ziegenhagen@gmail.com> writes:

> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>> 
>> Thorsten Jolitz <tjolitz <at> gmail.com> writes:
>> 
>> >
>> > Isn't it a feature of Org-mode that tasks can be added anywhere without
>> > giving a thought in the agenda files, letting the agenda itself sort
>> > them by date? Just changing the timestamp from monday to tuesday would
>> > do the job in a normal workflow, making the agenda-file structuring by
>> > day redundant.
>
> The way that I currently use Org Mode is the following
>
> On level 1 I have all the weeks, on level 2 the tasks
>
> * 2014-05-26--2014-06-01
> ** TODO [#C] Python Test
>
> I know org mode offers way more functionalities, but right now I am
> exploring the basics.

But basic idiomatic use would be a simple

,-----------------------------------------
| * TODO [#C] Python Test <2014-05-29 Do>
`-----------------------------------------

or maybe using a period with 2 timestamps

 ,---------------------------------
 | <2014-05-29 Do>--<2014-05-30 Fr>
 `---------------------------------

or SCHEDULED or DEADLINE planning elements. You can even use repeaters
etc then. 

Your system uses time info for file structuring, but Org has timestamps
for time info and the agenda for dealing with time and organizing
entries. 

-- 
cheers,
Thorsten

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

* Re: move org line to next superior level
  2014-05-29 14:28 ` Thorsten Jolitz
  2014-05-29 15:12   ` Eric Abrahamsen
@ 2014-05-29 18:15   ` Uwe Ziegenhagen
  2014-05-30  9:16     ` Thorsten Jolitz
  1 sibling, 1 reply; 8+ messages in thread
From: Uwe Ziegenhagen @ 2014-05-29 18:15 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz <at> gmail.com> writes:

 
> #+begin_src emacs-lisp
>   (defun tj/move-entry-to-next-day ()
>     "Move entry at point to next parent and tag it."
>     (unless (org-on-heading-p)
>       (outline-previous-heading))
>     (org-mark-subtree)
>     (kill-region (region-beginning) (region-end))
>     (org-up-heading-safe)
>     (org-forward-heading-same-level 1)
>     (forward-line)
>     (yank)
>     (outline-previous-heading)
>     (org-mark-subtree)
>     (org-change-tag-in-region 
>      (region-beginning) (region-end) "postponed" nil))
> #+end_src
> 
> This works with you example Org snippet, but is not tested otherwise. 
> 

Hi Thorsten,

your code works fine, I'd like to change it a little in that way that the
original line should remain but should get the status "POSTPONED"

I tried by inserting a new (yank) line, this didn't work as it sometimes
moved the entry two headlines away. I am also not sure if org-todo is the
correct command:

(defun tj/move-entry-to-next-day ()
    "Move entry at point to next parent and tag it."
    (unless (org-on-heading-p)
      (outline-previous-heading))
    (org-mark-subtree)
    (kill-region (region-beginning) (region-end))
    (yank) ;; causes issues
    (org-todo "POSTPONED") ;; is this correct?
    (org-up-heading-safe)
    (org-forward-heading-same-level 2)
    (forward-line)
    (yank)
    (outline-previous-heading)
    (org-mark-subtree)
    (org-change-tag-in-region 
     (region-beginning) (region-end) "postponed" nil))



Uwe

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

* Re: move org line to next superior level
  2014-05-29 18:15   ` Uwe Ziegenhagen
@ 2014-05-30  9:16     ` Thorsten Jolitz
  0 siblings, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-05-30  9:16 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Ziegenhagen <ziegenhagen@gmail.com> writes:

> Thorsten Jolitz <tjolitz <at> gmail.com> writes:
>
>  
>> #+begin_src emacs-lisp
>>   (defun tj/move-entry-to-next-day ()
>>     "Move entry at point to next parent and tag it."
>>     (unless (org-on-heading-p)
>>       (outline-previous-heading))
>>     (org-mark-subtree)
>>     (kill-region (region-beginning) (region-end))
>>     (org-up-heading-safe)
>>     (org-forward-heading-same-level 1)
>>     (forward-line)
>>     (yank)
>>     (outline-previous-heading)
>>     (org-mark-subtree)
>>     (org-change-tag-in-region 
>>      (region-beginning) (region-end) "postponed" nil))
>> #+end_src
>> 
>> This works with you example Org snippet, but is not tested otherwise. 
>> 
>
> Hi Thorsten,
>
> your code works fine, I'd like to change it a little in that way that the
> original line should remain but should get the status "POSTPONED"
>
> I tried by inserting a new (yank) line, this didn't work as it sometimes
> moved the entry two headlines away. I am also not sure if org-todo is the
> correct command:
>
> (defun tj/move-entry-to-next-day ()
>     "Move entry at point to next parent and tag it."
>     (unless (org-on-heading-p)
>       (outline-previous-heading))
>     (org-mark-subtree)
>     (kill-region (region-beginning) (region-end))
>     (yank) ;; causes issues
>     (org-todo "POSTPONED") ;; is this correct?
>     (org-up-heading-safe)
>     (org-forward-heading-same-level 2)
>     (forward-line)
>     (yank)
>     (outline-previous-heading)
>     (org-mark-subtree)
>     (org-change-tag-in-region 
>      (region-beginning) (region-end) "postponed" nil))


Here is a more robust version of the function, that works for me on your
example snippet

#+begin_src emacs-lisp
  (defun tj/copy-entry-to-next-day (state)
    "Copy entry at point to next parent and change its STATE."
    (interactive "sState: ")
    (save-excursion
      (save-restriction
        (widen)
        (unless (org-on-heading-p)
          (outline-previous-heading))
        (org-copy-subtree)
        (org-todo state)
        (org-up-heading-safe)
        (org-forward-heading-same-level 2)
        (forward-line)
        (org-yank))))
#+end_src

thus 

,---------------------------------------
| M-x tj/copy-entry-to-next-day RET DONE
`---------------------------------------

converts 

,-------------
| * aaa
| ** TODO cccc
| * bbb
| ** TODO dddd
`-------------

to

,----------------------------------------------------------------
| * aaa
| ** DONE cccc
|    - State "DONE"       from "TODO"       [2014-05-30 Fr 11:00]
| * bbb
| ** TODO cccc
| ** TODO dddd
`----------------------------------------------------------------

This works, because in my config, C-h v org-todo-keywords shows:

,------------------------------------------------------------------------
| org-todo-keywords is a variable defined in `org.el'.
| Its value is
| ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!/!)")
|  (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE"))
| 
| Original value was 
| ((sequence "TODO" "DONE"))
`------------------------------------------------------------------------

thus DONE is defined. If you want to use "POSTPONED", you need to 

,---------------------------------------------
| M-x customize-variable RET org-todo-keywords
`---------------------------------------------

and add it. 

But anyway, I still think you complicate your life unnessesary with this
unidiomatic workflow. If you do use this function, the interactive
part could be improve to let you select from the defined
org-todo-keywords. 

-- 
cheers,
Thorsten

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

end of thread, other threads:[~2014-05-30  9:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-29  3:57 move org line to next superior level Uwe Ziegenhagen
2014-05-29 14:28 ` Thorsten Jolitz
2014-05-29 15:12   ` Eric Abrahamsen
2014-05-29 17:16     ` Uwe Ziegenhagen
2014-05-29 18:03       ` Thorsten Jolitz
2014-05-29 18:15   ` Uwe Ziegenhagen
2014-05-30  9:16     ` Thorsten Jolitz
2014-05-29 17:29 ` Bastien

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