emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Move to item to the bottom
@ 2011-06-30 16:13 Marcelo de Moraes Serpa
  2011-06-30 18:55 ` Nicolas Goaziou
  0 siblings, 1 reply; 25+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-06-30 16:13 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

Hi list,

It'd be nice if we could just send an item to the bottom of a list. Useful
when reviewing a long list and putting the next actions in the top. Is there
a way to do that with org currently?

Cheers,

M>

[-- Attachment #2: Type: text/html, Size: 292 bytes --]

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

* Re: Move to item to the bottom
  2011-06-30 16:13 Move to item to the bottom Marcelo de Moraes Serpa
@ 2011-06-30 18:55 ` Nicolas Goaziou
  2011-07-01  6:35   ` Nicolas Goaziou
  0 siblings, 1 reply; 25+ messages in thread
From: Nicolas Goaziou @ 2011-06-30 18:55 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Org Mode

Hello,

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

> It'd be nice if we could just send an item to the bottom of a list. Useful
> when reviewing a long list and putting the next actions in the top. Is there
> a way to do that with org currently?

Not heavily tested, but something like the following snippet should
work:

#+begin_src emacs-lisp
(defun ngz-move-item-at-bottom ()
  "Move item at point at the bottom of the list.
Note that the item will be become the last item of the top-level
list, whatever its original indentation was."
  (interactive)
  (if (not (org-at-item-p))
      (error "Not in a list")
    (let* ((item (point-at-bol))
           (struct (org-list-struct))
           (top-item (org-list-get-top-point struct))
           (end (org-list-get-item-end item struct))
           (bullet (org-list-get-bullet item struct))
           (body (org-trim
                  (buffer-substring (progn (looking-at (concat "[ \t]*" bullet))
                                           (match-end 0))
                                    end)))
           (prevs (org-list-prevs-alist struct))
           (last-top-level-item (org-list-get-last-item top-item struct prevs))
           (ins-point (save-excursion (goto-char last-top-level-item)
                                      (point-at-eol)))
           (org-M-RET-may-split-line nil))
      (if (= item last-top-level-item)
          (error "Item is already at the bottom of the list")
        (save-excursion (org-list-insert-item ins-point struct prevs nil body))
        (delete-region item end)))))
#+end_src

Regards,

-- 
Nicolas Goaziou

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

* Re: Move to item to the bottom
  2011-06-30 18:55 ` Nicolas Goaziou
@ 2011-07-01  6:35   ` Nicolas Goaziou
  2011-07-01  8:57     ` Bastien
  0 siblings, 1 reply; 25+ messages in thread
From: Nicolas Goaziou @ 2011-07-01  6:35 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Org Mode

Correcting myself, I paste here another try to the problem at
hand. Indeed, moving an item to a list he doesn't directly belong to
makes little sense. Thus, the item will be moved at the end of its list.

#+begin_src emacs-lisp
(defun ngz-move-item-at-bottom ()
  "Move item at point at the bottom of the list."
  (interactive)
  (if (not (org-at-item-p))
      (error "Not in a list")
    (let* ((item (point-at-bol))
           (struct (org-list-struct))
           (end (org-list-get-item-end item struct))
           (bullet (regexp-quote (org-list-get-bullet item struct)))
           (body (org-trim
                  (buffer-substring (progn (looking-at (concat "[ \t]*" bullet))
                                           (match-end 0))
                                    end)))
           (prevs (org-list-prevs-alist struct))
           (last-item (org-list-get-last-item item struct prevs))
           (ins-point (save-excursion (goto-char last-item) (point-at-eol)))
           (org-M-RET-may-split-line nil))
      (if (= item last-item)
          (error "Item is already at the bottom of the list")
        (save-excursion (org-list-insert-item ins-point struct prevs nil body))
        (delete-region item end)
        (org-list-repair)
        (org-update-checkbox-count-maybe)))))
#+end_src

That function will compute list structure two times (at
`org-list-struct' and `org-list-repair' calls), which is bad. It may be
interesting to implement an `org-list-delete-item' to solve that problem
(it would return structure of the list after deletion, removing the need
to recompute it). I'll add it to org-list.el if it proves useful enough
(i.e. others use-cases than this function).

Regards,

-- 
Nicolas Goaziou

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

* Re: Move to item to the bottom
  2011-07-01  6:35   ` Nicolas Goaziou
@ 2011-07-01  8:57     ` Bastien
  2011-07-01  9:10       ` Nicolas Goaziou
  2011-07-01  9:34       ` Carsten Dominik
  0 siblings, 2 replies; 25+ messages in thread
From: Bastien @ 2011-07-01  8:57 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode, Marcelo de Moraes Serpa

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Correcting myself, I paste here another try to the problem at
> hand. Indeed, moving an item to a list he doesn't directly belong to
> makes little sense. Thus, the item will be moved at the end of its
> list.

Nice.  Such a move could be bound to M-<up> when the cursor is on the
first item, instead of throwing an error, as it does now.

What do you think?

-- 
 Bastien

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

* Re: Move to item to the bottom
  2011-07-01  8:57     ` Bastien
@ 2011-07-01  9:10       ` Nicolas Goaziou
  2011-07-01  9:32         ` Bastien
  2011-07-01  9:34       ` Carsten Dominik
  1 sibling, 1 reply; 25+ messages in thread
From: Nicolas Goaziou @ 2011-07-01  9:10 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode, Marcelo de Moraes Serpa

Hello,

Bastien <bzg@altern.org> writes:

>> Correcting myself, I paste here another try to the problem at
>> hand. Indeed, moving an item to a list he doesn't directly belong to
>> makes little sense. Thus, the item will be moved at the end of its
>> list.
>
> Nice.  Such a move could be bound to M-<up> when the cursor is on the
> first item, instead of throwing an error, as it does now.
>
> What do you think?

Good idea, as long as M-<down> also moves the last item to the top
position.

It needs a better optimization (my excuse for
`org-list-delete-item'). I will work on it tonight.

Regards,

-- 
Nicolas Goaziou

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

* Re: Move to item to the bottom
  2011-07-01  9:10       ` Nicolas Goaziou
@ 2011-07-01  9:32         ` Bastien
  2011-07-02 19:25           ` Nicolas Goaziou
  0 siblings, 1 reply; 25+ messages in thread
From: Bastien @ 2011-07-01  9:32 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode, Marcelo de Moraes Serpa

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> It needs a better optimization (my excuse for
> `org-list-delete-item'). I will work on it tonight.

Thanks!  

I'm really excited by all this activity/features/questions.

I'm still focusing on our main goal, though, which is to 
release 7.6 ASAP so that it will be included in Emacs pretest.

I plan to make the release by *sunday morning*.

-- 
 Bastien

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

* Re: Move to item to the bottom
  2011-07-01  8:57     ` Bastien
  2011-07-01  9:10       ` Nicolas Goaziou
@ 2011-07-01  9:34       ` Carsten Dominik
  2011-07-01  9:46         ` Bastien
  2011-07-01 10:14         ` Eric S Fraga
  1 sibling, 2 replies; 25+ messages in thread
From: Carsten Dominik @ 2011-07-01  9:34 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode, Nicolas Goaziou, Marcelo de Moraes Serpa


On Jul 1, 2011, at 10:57 AM, Bastien wrote:

> Hi Nicolas,
> 
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
> 
>> Correcting myself, I paste here another try to the problem at
>> hand. Indeed, moving an item to a list he doesn't directly belong to
>> makes little sense. Thus, the item will be moved at the end of its
>> list.
> 
> Nice.  Such a move could be bound to M-<up> when the cursor is on the
> first item, instead of throwing an error, as it does now.
> 
> What do you think?

This does sound counter-intuitive to me.

- Carsten

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

* Re: Move to item to the bottom
  2011-07-01  9:34       ` Carsten Dominik
@ 2011-07-01  9:46         ` Bastien
  2011-07-01 10:25           ` Carsten Dominik
  2011-07-01 10:14         ` Eric S Fraga
  1 sibling, 1 reply; 25+ messages in thread
From: Bastien @ 2011-07-01  9:46 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org Mode, Nicolas Goaziou, Marcelo de Moraes Serpa

Carsten Dominik <carsten.dominik@gmail.com> writes:

> This does sound counter-intuitive to me.

Why?

The idea is that someone who wants to move a first item to the top
really wants to cycle through items -- same for moving the bottom item
to the bottom, where the user really wants to move it to the top.

Actually, it's important to have both feature to let the user navigate
back and forth.

-- 
 Bastien

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

* Re: Move to item to the bottom
  2011-07-01  9:34       ` Carsten Dominik
  2011-07-01  9:46         ` Bastien
@ 2011-07-01 10:14         ` Eric S Fraga
  2011-07-01 10:27           ` Carsten Dominik
  1 sibling, 1 reply; 25+ messages in thread
From: Eric S Fraga @ 2011-07-01 10:14 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: Bastien, Org Mode, Nicolas Goaziou, Marcelo de Moraes Serpa

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On Jul 1, 2011, at 10:57 AM, Bastien wrote:
>
>> Hi Nicolas,
>> 
>> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>> 
>>> Correcting myself, I paste here another try to the problem at
>>> hand. Indeed, moving an item to a list he doesn't directly belong to
>>> makes little sense. Thus, the item will be moved at the end of its
>>> list.
>> 
>> Nice.  Such a move could be bound to M-<up> when the cursor is on the
>> first item, instead of throwing an error, as it does now.
>> 
>> What do you think?
>
> This does sound counter-intuitive to me.
>
> - Carsten
>

I agree but there *is* some precedence for this type of behaviour in
Emacs: e.g. the bs buffer display package where moving up (<up>) at the
top of the list of buffers takes you to the bottom of the list and vice
versa (<down>)?

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.533.gdffdb)

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

* Re: Move to item to the bottom
  2011-07-01  9:46         ` Bastien
@ 2011-07-01 10:25           ` Carsten Dominik
  2011-07-01 16:07             ` Bastien
  0 siblings, 1 reply; 25+ messages in thread
From: Carsten Dominik @ 2011-07-01 10:25 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode, Nicolas Goaziou, Marcelo de Moraes Serpa


On Jul 1, 2011, at 11:46 AM, Bastien wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
> 
>> This does sound counter-intuitive to me.
> 
> Why?
> 
> The idea is that someone who wants to move a first item to the top
> really wants to cycle through items -- same for moving the bottom item
> to the bottom, where the user really wants to move it to the top.

I do not agree, if I move something up, I never want it to go down.
A list is not a circle.  Maybe C-M-down, or C-u M-down
or so might be a possibility.

> 
> Actually, it's important to have both feature to let the user navigate
> back and forth.

Yes, symmetry is always good.

- Carsten

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

* Re: Move to item to the bottom
  2011-07-01 10:14         ` Eric S Fraga
@ 2011-07-01 10:27           ` Carsten Dominik
  0 siblings, 0 replies; 25+ messages in thread
From: Carsten Dominik @ 2011-07-01 10:27 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Bastien, Org Mode, Nicolas Goaziou, Marcelo de Moraes Serpa


On Jul 1, 2011, at 12:14 PM, Eric S Fraga wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
> 
>> On Jul 1, 2011, at 10:57 AM, Bastien wrote:
>> 
>>> Hi Nicolas,
>>> 
>>> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>>> 
>>>> Correcting myself, I paste here another try to the problem at
>>>> hand. Indeed, moving an item to a list he doesn't directly belong to
>>>> makes little sense. Thus, the item will be moved at the end of its
>>>> list.
>>> 
>>> Nice.  Such a move could be bound to M-<up> when the cursor is on the
>>> first item, instead of throwing an error, as it does now.
>>> 
>>> What do you think?
>> 
>> This does sound counter-intuitive to me.
>> 
>> - Carsten
>> 
> 
> I agree but there *is* some precedence for this type of behaviour in
> Emacs: e.g. the bs buffer display package where moving up (<up>) at the
> top of the list of buffers takes you to the bottom of the list and vice
> versa (<down>)?

I think this is different.  You are talking about selecting an item.
Moving list items feels different, at least for me.

- Carsten

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

* Re: Move to item to the bottom
  2011-07-01 10:25           ` Carsten Dominik
@ 2011-07-01 16:07             ` Bastien
  2011-07-01 16:59               ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 25+ messages in thread
From: Bastien @ 2011-07-01 16:07 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org Mode, Nicolas Goaziou, Marcelo de Moraes Serpa

Hi Carsten,

Carsten Dominik <carsten.dominik@gmail.com> writes:

> I do not agree, if I move something up, I never want it to go down.
> A list is not a circle.  Maybe C-M-down, or C-u M-down
> or so might be a possibility.

Agreed, C-M-up will surely be less surprising.

Let's wait for Nicolas's patch about this and give feedback against 
real testing. 

There is no hurry to make this change, we can delay it after taking 
the time to test/discuss.

-- 
 Bastien

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

* Re: Move to item to the bottom
  2011-07-01 16:07             ` Bastien
@ 2011-07-01 16:59               ` Marcelo de Moraes Serpa
  2011-07-01 19:25                 ` Nicolas Goaziou
  0 siblings, 1 reply; 25+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-07-01 16:59 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode, Nicolas Goaziou, Carsten Dominik

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

Nice discussion!

Nicolas, what if all the items are top-level items? My gtd.org file is
basically a flat list of projects and I don't have a main top list for that
wraps them. Any ideas?

Cheers,

M>

On Fri, Jul 1, 2011 at 11:07 AM, Bastien <bzg@altern.org> wrote:

> Hi Carsten,
>
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
> > I do not agree, if I move something up, I never want it to go down.
> > A list is not a circle.  Maybe C-M-down, or C-u M-down
> > or so might be a possibility.
>
> Agreed, C-M-up will surely be less surprising.
>
> Let's wait for Nicolas's patch about this and give feedback against
> real testing.
>
> There is no hurry to make this change, we can delay it after taking
> the time to test/discuss.
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1303 bytes --]

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

* Re: Move to item to the bottom
  2011-07-01 16:59               ` Marcelo de Moraes Serpa
@ 2011-07-01 19:25                 ` Nicolas Goaziou
  2011-07-01 22:58                   ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 25+ messages in thread
From: Nicolas Goaziou @ 2011-07-01 19:25 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Bastien, Org Mode, Carsten Dominik

Hello,

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

> Nicolas, what if all the items are top-level items? My gtd.org file is
> basically a flat list of projects and I don't have a main top list for that
> wraps them. Any ideas?

I'm not sure to understand. If all the items are at top level, the
function will move the current item at the bottom of the list. Every
item belongs to a list.

Or are we talking about two different things?

Regards,

-- 
Nicolas Goaziou

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

* Re: Move to item to the bottom
  2011-07-01 19:25                 ` Nicolas Goaziou
@ 2011-07-01 22:58                   ` Marcelo de Moraes Serpa
  2011-07-02  8:05                     ` Nicolas Goaziou
  0 siblings, 1 reply; 25+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-07-01 22:58 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, Org Mode, Carsten Dominik

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

Nicolas,

Or are we talking about two different things?

Not sure, maybe. What I mean is:

gtd.org file:

* TODO Blah
* TODO Foo
* TODO bar

Instead of:

gtd.org file:

* Tasks
** TODO Blah
** TODO Foo
** TODO Bar

So, the items in gtd.org files are all top-level, they don't belong to a
list (unless org considers a virtual top level main list)

Cheers,

Marcelo.


On Fri, Jul 1, 2011 at 2:25 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> Hello,
>
> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>
> > Nicolas, what if all the items are top-level items? My gtd.org file is
> > basically a flat list of projects and I don't have a main top list for
> that
> > wraps them. Any ideas?
>
> I'm not sure to understand. If all the items are at top level, the
> function will move the current item at the bottom of the list. Every
> item belongs to a list.
>
> Or are we talking about two different things?
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 2014 bytes --]

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

* Re: Move to item to the bottom
  2011-07-01 22:58                   ` Marcelo de Moraes Serpa
@ 2011-07-02  8:05                     ` Nicolas Goaziou
  2011-07-02  9:06                       ` Bastien
  0 siblings, 1 reply; 25+ messages in thread
From: Nicolas Goaziou @ 2011-07-02  8:05 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Bastien, Org Mode, Carsten Dominik

Hello,

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

>> Or are we talking about two different things?
>
> Not sure, maybe. What I mean is:
>
> gtd.org file:
>
> * TODO Blah
> * TODO Foo
> * TODO bar

[...]

That's what I thought. You are talking about headlines whereas my code
was about plain lists:

- Blah
- Foo
- bar

Forget about it then.

To achieve the desired effect, you may simply use this:

#+begin_src emacs-lisp
(defun ngz-move-headline-at-bottom ()
  "Move current headline to the last position in the same tree."
  (interactive)
  (unless (org-at-heading-p) (error "Not at an headline"))
  (while (ignore-errors (org-move-subtree-down))))
#+end_src


Regards,

-- 
Nicolas Goaziou

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

* Re: Move to item to the bottom
  2011-07-02  8:05                     ` Nicolas Goaziou
@ 2011-07-02  9:06                       ` Bastien
  0 siblings, 0 replies; 25+ messages in thread
From: Bastien @ 2011-07-02  9:06 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode, Marcelo de Moraes Serpa, Carsten Dominik

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> That's what I thought. You are talking about headlines whereas my code
> was about plain lists:

FWIW, I was also talking about plain lists, not headlines.

-- 
 Bastien

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

* Re: Move to item to the bottom
  2011-07-01  9:32         ` Bastien
@ 2011-07-02 19:25           ` Nicolas Goaziou
  2011-07-03  2:02             ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 25+ messages in thread
From: Nicolas Goaziou @ 2011-07-02 19:25 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode, Marcelo de Moraes Serpa

Hello,

Bastien <bzg@altern.org> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> It needs a better optimization (my excuse for
>> `org-list-delete-item'). I will work on it tonight.
>
> Thanks!  

I've pushed a draft to:

           git://github.com/ngz/org-mode-lists.git move-cycle


The branch is made of two patches. The first one implements the
all-mighty (but not-so useful) `org-list-send-item' function. Here is
its doc-string:

  Send ITEM to destination DEST.

  STRUCT is the list structure.

  DEST can have various values.

  If DEST is a buffer position, the function will assume it points
  to another item in the same list as ITEM, and will move the
  latter just before the former.

  If DEST is `begin' (resp. `end'), ITEM will be moved at the
  beginning (resp. end) of the list it belongs to.

  If DEST is a string like "N", where N is an integer, ITEM will
  be moved at the Nth position in the list.

  If DEST is `kill-ring', ITEM will be deleted and its body will be
  added to the kill-ring.

  If DEST is nil, ITEM will be deleted.

  This function returns, destructively, the new list structure.


The second one changes the behavior of `org-move-item-up' (and not
`org-move-item-down, for comparison). When the user tries to move the
first item of a list up, the function will ask him whether he wants to
roll it back to the end of the list, or not.

I'm not particularly convinced by that feature, but I implemented it
nonetheless for 2 reasons:
  1. it doesn't add yet another key-binding;
  2. it doesn't prevent macros to stop at the beginning of the list
     (when using C-u 0 <F4>).

So, what do you all think about it?


Regards,

-- 
Nicolas Goaziou

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

* Re: Move to item to the bottom
  2011-07-02 19:25           ` Nicolas Goaziou
@ 2011-07-03  2:02             ` Marcelo de Moraes Serpa
  2011-07-03  9:39               ` Nicolas Goaziou
  0 siblings, 1 reply; 25+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-07-03  2:02 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, Org Mode

[-- Attachment #1: Type: text/plain, Size: 2160 bytes --]

Nicolas, the function works quite well!  Thanks. Just one last request: Is
it possible to not follow the item until the bottom? The issue is that, once
running it and when the item is sent to the bottom of the file, the pointer
is also put there and the buffer scrolls down with it.

Cheers,

M>

On Sat, Jul 2, 2011 at 2:25 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> Hello,
>
> Bastien <bzg@altern.org> writes:
>
> > Nicolas Goaziou <n.goaziou@gmail.com> writes:
> >
> >> It needs a better optimization (my excuse for
> >> `org-list-delete-item'). I will work on it tonight.
> >
> > Thanks!
>
> I've pushed a draft to:
>
>           git://github.com/ngz/org-mode-lists.git move-cycle
>
>
> The branch is made of two patches. The first one implements the
> all-mighty (but not-so useful) `org-list-send-item' function. Here is
> its doc-string:
>
>  Send ITEM to destination DEST.
>
>  STRUCT is the list structure.
>
>  DEST can have various values.
>
>  If DEST is a buffer position, the function will assume it points
>  to another item in the same list as ITEM, and will move the
>  latter just before the former.
>
>  If DEST is `begin' (resp. `end'), ITEM will be moved at the
>  beginning (resp. end) of the list it belongs to.
>
>  If DEST is a string like "N", where N is an integer, ITEM will
>  be moved at the Nth position in the list.
>
>  If DEST is `kill-ring', ITEM will be deleted and its body will be
>  added to the kill-ring.
>
>  If DEST is nil, ITEM will be deleted.
>
>  This function returns, destructively, the new list structure.
>
>
> The second one changes the behavior of `org-move-item-up' (and not
> `org-move-item-down, for comparison). When the user tries to move the
> first item of a list up, the function will ask him whether he wants to
> roll it back to the end of the list, or not.
>
> I'm not particularly convinced by that feature, but I implemented it
> nonetheless for 2 reasons:
>  1. it doesn't add yet another key-binding;
>  2. it doesn't prevent macros to stop at the beginning of the list
>     (when using C-u 0 <F4>).
>
> So, what do you all think about it?
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 2983 bytes --]

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

* Re: Move to item to the bottom
  2011-07-03  2:02             ` Marcelo de Moraes Serpa
@ 2011-07-03  9:39               ` Nicolas Goaziou
  2011-07-05  3:27                 ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 25+ messages in thread
From: Nicolas Goaziou @ 2011-07-03  9:39 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Bastien, Org Mode

Hello,

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

> Nicolas, the function works quite well!  Thanks. Just one last request: Is
> it possible to not follow the item until the bottom? The issue is that, once
> running it and when the item is sent to the bottom of the file, the pointer
> is also put there and the buffer scrolls down with it.


Sure, it's simple as packing it into a (save-excursion ...)

#+begin_src emacs-lisp
(defun ngz-move-headline-at-bottom ()
  "Move current headline to the last position in the same tree"
  (interactive)
  (unless (org-at-heading-p) (error "Not at an headline"))
  (save-excursion (while (ignore-errors (org-move-subtree-down)))))
#+end_src

Regards,

-- 
Nicolas Goaziou

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

* Re: Move to item to the bottom
  2011-07-03  9:39               ` Nicolas Goaziou
@ 2011-07-05  3:27                 ` Marcelo de Moraes Serpa
  2011-07-07 15:51                   ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 25+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-07-05  3:27 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, Org Mode

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

I definitely need to get my head around elisp. Thank you very much.

On Sun, Jul 3, 2011 at 4:39 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> Hello,
>
> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>
> > Nicolas, the function works quite well!  Thanks. Just one last request:
> Is
> > it possible to not follow the item until the bottom? The issue is that,
> once
> > running it and when the item is sent to the bottom of the file, the
> pointer
> > is also put there and the buffer scrolls down with it.
>
>
> Sure, it's simple as packing it into a (save-excursion ...)
>
> #+begin_src emacs-lisp
> (defun ngz-move-headline-at-bottom ()
>  "Move current headline to the last position in the same tree"
>  (interactive)
>  (unless (org-at-heading-p) (error "Not at an headline"))
>   (save-excursion (while (ignore-errors (org-move-subtree-down)))))
> #+end_src
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 1418 bytes --]

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

* Re: Move to item to the bottom
  2011-07-05  3:27                 ` Marcelo de Moraes Serpa
@ 2011-07-07 15:51                   ` Marcelo de Moraes Serpa
  2011-07-20 16:05                     ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 25+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-07-07 15:51 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, Org Mode

[-- Attachment #1: Type: text/plain, Size: 1853 bytes --]

It's obvious, but here's the snippet to promote the headline for your
convenience:


(defun ngz-move-headline-up ()
  "Move current headline to the top of the tree"
  (interactive)
  (unless (org-at-heading-p) (error "Not at an headline"))
  (save-excursion (while (ignore-errors (org-move-subtree-up)))))


The only minor issue I have now is with my org file conf section. It's
supposed to be the last item in the file, but when I send the item to the
bottom, it starts pilling up as I add more.

It would be nice if we could setup a special tag for the conf section of the
org file, i.e:

* conf  :HIDDEN:
#+STARTUP: overview
...

HIDDEN items would be hidden unless show-hidden-items toggles. Does that
make sense?

Cheers,

Marcelo.

On Mon, Jul 4, 2011 at 10:27 PM, Marcelo de Moraes Serpa <
celoserpa@gmail.com> wrote:

> I definitely need to get my head around elisp. Thank you very much.
>
>
> On Sun, Jul 3, 2011 at 4:39 AM, Nicolas Goaziou <n.goaziou@gmail.com>wrote:
>
>> Hello,
>>
>> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>>
>> > Nicolas, the function works quite well!  Thanks. Just one last request:
>> Is
>> > it possible to not follow the item until the bottom? The issue is that,
>> once
>> > running it and when the item is sent to the bottom of the file, the
>> pointer
>> > is also put there and the buffer scrolls down with it.
>>
>>
>> Sure, it's simple as packing it into a (save-excursion ...)
>>
>> #+begin_src emacs-lisp
>> (defun ngz-move-headline-at-bottom ()
>>  "Move current headline to the last position in the same tree"
>>  (interactive)
>>  (unless (org-at-heading-p) (error "Not at an headline"))
>>   (save-excursion (while (ignore-errors (org-move-subtree-down)))))
>> #+end_src
>>
>> Regards,
>>
>> --
>> Nicolas Goaziou
>>
>
>

[-- Attachment #2: Type: text/html, Size: 2823 bytes --]

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

* Re: Move to item to the bottom
  2011-07-07 15:51                   ` Marcelo de Moraes Serpa
@ 2011-07-20 16:05                     ` Marcelo de Moraes Serpa
  2011-07-27 11:22                       ` Bastien
  0 siblings, 1 reply; 25+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-07-20 16:05 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, Org Mode

[-- Attachment #1: Type: text/plain, Size: 2568 bytes --]

[Feature suggestion] (related to what I described in the last post of this
thread):

Keep configuration options for an org file in a separate file. Could be:
 * nameoftheorgfile.conf

I know it seems awkward, but I think it'd be nice if we could keep org file
configurations outside of the org file, of course, as an optional feature.
Now, this wouldn't be complicated to implement, I'm sure, and I could even
try to hack it as part of some much needed elisp exercise.

Would that make sense?

Cheers,

Marcelo.


On Thu, Jul 7, 2011 at 10:51 AM, Marcelo de Moraes Serpa <
celoserpa@gmail.com> wrote:

> It's obvious, but here's the snippet to promote the headline for your
> convenience:
>
>
> (defun ngz-move-headline-up ()
>   "Move current headline to the top of the tree"
>   (interactive)
>   (unless (org-at-heading-p) (error "Not at an headline"))
>   (save-excursion (while (ignore-errors (org-move-subtree-up)))))
>
>
> The only minor issue I have now is with my org file conf section. It's
> supposed to be the last item in the file, but when I send the item to the
> bottom, it starts pilling up as I add more.
>
> It would be nice if we could setup a special tag for the conf section of
> the org file, i.e:
>
> * conf  :HIDDEN:
> #+STARTUP: overview
> ...
>
> HIDDEN items would be hidden unless show-hidden-items toggles. Does that
> make sense?
>
> Cheers,
> 
> Marcelo.
>
> On Mon, Jul 4, 2011 at 10:27 PM, Marcelo de Moraes Serpa <
> celoserpa@gmail.com> wrote:
>
>> I definitely need to get my head around elisp. Thank you very much.
>>
>>
>> On Sun, Jul 3, 2011 at 4:39 AM, Nicolas Goaziou <n.goaziou@gmail.com>wrote:
>>
>>> Hello,
>>>
>>> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>>>
>>> > Nicolas, the function works quite well!  Thanks. Just one last request:
>>> Is
>>> > it possible to not follow the item until the bottom? The issue is that,
>>> once
>>> > running it and when the item is sent to the bottom of the file, the
>>> pointer
>>> > is also put there and the buffer scrolls down with it.
>>>
>>>
>>> Sure, it's simple as packing it into a (save-excursion ...)
>>>
>>> #+begin_src emacs-lisp
>>> (defun ngz-move-headline-at-bottom ()
>>>  "Move current headline to the last position in the same tree"
>>>  (interactive)
>>>  (unless (org-at-heading-p) (error "Not at an headline"))
>>>   (save-excursion (while (ignore-errors (org-move-subtree-down)))))
>>> #+end_src
>>>
>>> Regards,
>>>
>>> --
>>> Nicolas Goaziou
>>>
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 3896 bytes --]

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

* Re: Move to item to the bottom
  2011-07-20 16:05                     ` Marcelo de Moraes Serpa
@ 2011-07-27 11:22                       ` Bastien
  2011-07-27 23:12                         ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 25+ messages in thread
From: Bastien @ 2011-07-27 11:22 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Org Mode, Nicolas Goaziou

Hi Marcelo,

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

> [Feature suggestion] (related to what I described in the last post of
> this thread):
>
> Keep configuration options for an org file in a separate file. Could
> be:
>  * nameoftheorgfile.conf

I don't think this is necessary.  You can already include setup files 
by using the #+SETUPFILE: option.

HTH,

-- 
 Bastien

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

* Re: Move to item to the bottom
  2011-07-27 11:22                       ` Bastien
@ 2011-07-27 23:12                         ` Marcelo de Moraes Serpa
  0 siblings, 0 replies; 25+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-07-27 23:12 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

Hi Bastien,

Thanks, did not know about it.

M>

On Wed, Jul 27, 2011 at 6:22 AM, Bastien <bzg@altern.org> wrote:

> Hi Marcelo,
>
> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>
> > [Feature suggestion] (related to what I described in the last post of
> > this thread):
> >
> > Keep configuration options for an org file in a separate file. Could
> > be:
> >  * nameoftheorgfile.conf
>
> I don't think this is necessary.  You can already include setup files
> by using the #+SETUPFILE: option.
>
> HTH,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1012 bytes --]

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

end of thread, other threads:[~2011-07-27 23:12 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-30 16:13 Move to item to the bottom Marcelo de Moraes Serpa
2011-06-30 18:55 ` Nicolas Goaziou
2011-07-01  6:35   ` Nicolas Goaziou
2011-07-01  8:57     ` Bastien
2011-07-01  9:10       ` Nicolas Goaziou
2011-07-01  9:32         ` Bastien
2011-07-02 19:25           ` Nicolas Goaziou
2011-07-03  2:02             ` Marcelo de Moraes Serpa
2011-07-03  9:39               ` Nicolas Goaziou
2011-07-05  3:27                 ` Marcelo de Moraes Serpa
2011-07-07 15:51                   ` Marcelo de Moraes Serpa
2011-07-20 16:05                     ` Marcelo de Moraes Serpa
2011-07-27 11:22                       ` Bastien
2011-07-27 23:12                         ` Marcelo de Moraes Serpa
2011-07-01  9:34       ` Carsten Dominik
2011-07-01  9:46         ` Bastien
2011-07-01 10:25           ` Carsten Dominik
2011-07-01 16:07             ` Bastien
2011-07-01 16:59               ` Marcelo de Moraes Serpa
2011-07-01 19:25                 ` Nicolas Goaziou
2011-07-01 22:58                   ` Marcelo de Moraes Serpa
2011-07-02  8:05                     ` Nicolas Goaziou
2011-07-02  9:06                       ` Bastien
2011-07-01 10:14         ` Eric S Fraga
2011-07-01 10:27           ` Carsten Dominik

Code repositories for project(s) associated with this 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).