all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Moving checkbox item to end of list when checked
@ 2014-01-22 11:27 Cecil Westerhof
  2014-01-22 12:16 ` Thorsten Jolitz
  2014-01-22 13:36 ` Bastien
  0 siblings, 2 replies; 8+ messages in thread
From: Cecil Westerhof @ 2014-01-22 11:27 UTC (permalink / raw)
  To: emacs-orgmode

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

I have the folowing:
* Actions
  - [ ] A
  - [ ] B
  - [ ] C

When on A I give ‘C-c C-c’ I get:
* Actions
  - [X] A
  - [ ] B
  - [ ] C

but I would like to get:
* Actions
  - [ ] B
  - [ ] C
  - [X] A

Is this possible?
If not I could write an alias for it I think. Is there a command for going
to the end of the list?

-- 
Cecil Westerhof

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

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

* Re: Moving checkbox item to end of list when checked
  2014-01-22 11:27 Moving checkbox item to end of list when checked Cecil Westerhof
@ 2014-01-22 12:16 ` Thorsten Jolitz
  2014-01-22 14:58   ` Nicolas Goaziou
  2014-01-22 13:36 ` Bastien
  1 sibling, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-01-22 12:16 UTC (permalink / raw)
  To: emacs-orgmode

Cecil Westerhof <cldwesterhof@gmail.com> writes:

> I have the folowing:
> * Actions
 - [X] A
 - [ ] B
 - [ ] C
>
> When on A I give ‘C-c C-c’ I get:
> * Actions
>   - [X] A
>   - [ ] B
>   - [ ] C
>
> but I would like to get:
> * Actions
>   - [ ] B
>   - [ ] C
>   - [X] A
>
> Is this possible?
> If not I could write an alias for it I think. Is there a command for
> going to the end of the list?

Your function could be implemented along the line of:

1. put an 'after' advice on `org-toggle-checkbox'
2. use function `org-list-send-item' with DEST 'end to send 'ITEM at
   point' to the end of 'STRUCT at point' in this advice

#+begin_src emacs-lisp
(defun org-list-send-item (item dest struct)
  "Send ITEM to destination DEST.
  ...)
#+end_src

Its easy to get 'struct at point' with

#+begin_src emacs-lisp
(defun org-list-struct ()
  "Return structure of list at point.
   ...)
#+end_src

but I could not find an equivalent function to get the item at
point. 

-- 
cheers,
Thorsten

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

* Re: Moving checkbox item to end of list when checked
  2014-01-22 11:27 Moving checkbox item to end of list when checked Cecil Westerhof
  2014-01-22 12:16 ` Thorsten Jolitz
@ 2014-01-22 13:36 ` Bastien
  2014-01-22 14:06   ` Nicolas Goaziou
  1 sibling, 1 reply; 8+ messages in thread
From: Bastien @ 2014-01-22 13:36 UTC (permalink / raw)
  To: Cecil Westerhof; +Cc: emacs-orgmode

Hi Cecil,

Cecil Westerhof <cldwesterhof@gmail.com> writes:

> but I would like to get:
> * Actions
>   - [ ] B
>   - [ ] C
>   - [X] A
>
> Is this possible?

`C-c ^ x' to sort the list by checkbox status.

But this is an additional step after ticking the checkbox.

> If not I could write an alias for it I think. Is there a command for
> going to the end of the list?

Not a command, but an internal function you can explore:
`org-list-get-list-end'.

-- 
 Bastien

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

* Re: Moving checkbox item to end of list when checked
  2014-01-22 13:36 ` Bastien
@ 2014-01-22 14:06   ` Nicolas Goaziou
  2014-01-22 14:12     ` Cecil Westerhof
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2014-01-22 14:06 UTC (permalink / raw)
  To: Bastien; +Cc: Cecil Westerhof, emacs-orgmode

Hello,

Bastien <bzg@gnu.org> writes:

> Cecil Westerhof <cldwesterhof@gmail.com> writes:
>
>> but I would like to get:
>> * Actions
>>   - [ ] B
>>   - [ ] C
>>   - [X] A
>>
>> Is this possible?
>
> `C-c ^ x' to sort the list by checkbox status.
>
> But this is an additional step after ticking the checkbox.
>
>> If not I could write an alias for it I think. Is there a command for
>> going to the end of the list?
>
> Not a command, but an internal function you can explore:
> `org-list-get-list-end'.

I think that the higher-level function `org-list-send-item' would be
useful too:

  (org-list-send-item (line-beginning-position) 'end (org-list-struct))



Regards,

-- 
Nicolas Goaziou

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

* Re: Moving checkbox item to end of list when checked
  2014-01-22 14:06   ` Nicolas Goaziou
@ 2014-01-22 14:12     ` Cecil Westerhof
  2014-01-22 14:26       ` Cecil Westerhof
  0 siblings, 1 reply; 8+ messages in thread
From: Cecil Westerhof @ 2014-01-22 14:12 UTC (permalink / raw)
  To: emacs-orgmode

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

2014/1/22 Nicolas Goaziou <n.goaziou@gmail.com>

> >> but I would like to get:
> >> * Actions
> >>   - [ ] B
> >>   - [ ] C
> >>   - [X] A
> >>
> >> Is this possible?
> >
> > `C-c ^ x' to sort the list by checkbox status.
> >
> > But this is an additional step after ticking the checkbox.
> >
> >> If not I could write an alias for it I think. Is there a command for
> >> going to the end of the list?
> >
> > Not a command, but an internal function you can explore:
> > `org-list-get-list-end'.
>
> I think that the higher-level function `org-list-send-item' would be
> useful too:
>
>   (org-list-send-item (line-beginning-position) 'end (org-list-struct))
>

In a simple case this does exactly what I want. I have to check what
happens if it is several layers deep, but it looks certainly very
promising. Thanks.


-- 
Cecil Westerhof

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

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

* Re: Moving checkbox item to end of list when checked
  2014-01-22 14:12     ` Cecil Westerhof
@ 2014-01-22 14:26       ` Cecil Westerhof
  0 siblings, 0 replies; 8+ messages in thread
From: Cecil Westerhof @ 2014-01-22 14:26 UTC (permalink / raw)
  To: emacs-orgmode

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

2014/1/22 Cecil Westerhof <cldwesterhof@gmail.com>

> >> but I would like to get:
>
>> >> * Actions
>> >>   - [ ] B
>> >>   - [ ] C
>> >>   - [X] A
>> >>
>> >> Is this possible?
>> >
>> > `C-c ^ x' to sort the list by checkbox status.
>> >
>> > But this is an additional step after ticking the checkbox.
>> >
>> >> If not I could write an alias for it I think. Is there a command for
>> >> going to the end of the list?
>> >
>> > Not a command, but an internal function you can explore:
>> > `org-list-get-list-end'.
>>
>> I think that the higher-level function `org-list-send-item' would be
>> useful too:
>>
>>   (org-list-send-item (line-beginning-position) 'end (org-list-struct))
>>
>
> In a simple case this does exactly what I want. I have to check what
> happens if it is several layers deep, but it looks certainly very
> promising. Thanks.
>
>
It looks that it goes well also when the list is deeper.

I need to do the following things:
- check that I am on an element of a list
- check that it is a checkbox
- check that it is not checked

I
f I see it correctly this can all be done with (org-list-struct). I'll
work it out.

-- 
Cecil Westerhof

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

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

* Re: Moving checkbox item to end of list when checked
  2014-01-22 12:16 ` Thorsten Jolitz
@ 2014-01-22 14:58   ` Nicolas Goaziou
  2014-01-22 15:23     ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2014-01-22 14:58 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Hello,

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Your function could be implemented along the line of:
>
> 1. put an 'after' advice on `org-toggle-checkbox'

See also `org-checkbox-statistics-hook'

> Its easy to get 'struct at point' with
>
> #+begin_src emacs-lisp
> (defun org-list-struct ()
>   "Return structure of list at point.
>    ...)
> #+end_src
>
> but I could not find an equivalent function to get the item at
> point.

See `org-in-item-p'.


Regards,

-- 
Nicolas Goaziou

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

* Re: Moving checkbox item to end of list when checked
  2014-01-22 14:58   ` Nicolas Goaziou
@ 2014-01-22 15:23     ` Thorsten Jolitz
  0 siblings, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-01-22 15:23 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Your function could be implemented along the line of:
>>
>> 1. put an 'after' advice on `org-toggle-checkbox'
>
> See also `org-checkbox-statistics-hook'
>
>> Its easy to get 'struct at point' with
>>
>> #+begin_src emacs-lisp
>> (defun org-list-struct ()
>>   "Return structure of list at point.
>>    ...)
>> #+end_src
>>
>> but I could not find an equivalent function to get the item at
>> point.
>
> See `org-in-item-p'.

Ok, thanks for the tips

PS
My original message apparently took 3 hours to make it to the mailing
list, so it came a bit late to the party...

-- 
cheers,
Thorsten

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

end of thread, other threads:[~2014-01-22 15:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-22 11:27 Moving checkbox item to end of list when checked Cecil Westerhof
2014-01-22 12:16 ` Thorsten Jolitz
2014-01-22 14:58   ` Nicolas Goaziou
2014-01-22 15:23     ` Thorsten Jolitz
2014-01-22 13:36 ` Bastien
2014-01-22 14:06   ` Nicolas Goaziou
2014-01-22 14:12     ` Cecil Westerhof
2014-01-22 14:26       ` Cecil Westerhof

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.