* C-c ^ for plain lists? Why not?
@ 2012-10-08 14:41 James Harkins
2012-10-08 18:25 ` Nicolas Goaziou
2012-10-11 17:48 ` François Pinard
0 siblings, 2 replies; 10+ messages in thread
From: James Harkins @ 2012-10-08 14:41 UTC (permalink / raw)
To: emacs-orgmode
I've started to like checklists because they are a good way to keep account of things that have to be done, without the individual items being entered into the agenda (and thus transferred to MobileOrg).
But I'm running into the limitation that plain lists can't be sorted *by their checklist status*. You can sort alphabetically, numerically or by time or function. So, I guess I have to write a lisp function to do it... but I don't have time to do that right now, but I need to sort the list now...
Valid feature request?
hjh
--
James Harkins /// dewdrop world
jamshark70@dewdrop-world.net
http://www.dewdrop-world.net
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman
blog: http://www.dewdrop-world.net/words
audio clips: http://www.dewdrop-world.net/audio
more audio: http://soundcloud.com/dewdrop_world/tracks
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-c ^ for plain lists? Why not?
2012-10-08 14:41 C-c ^ for plain lists? Why not? James Harkins
@ 2012-10-08 18:25 ` Nicolas Goaziou
2012-10-09 0:06 ` James Harkins
2012-10-09 7:58 ` Carsten Dominik
2012-10-11 17:48 ` François Pinard
1 sibling, 2 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2012-10-08 18:25 UTC (permalink / raw)
To: James Harkins; +Cc: emacs-orgmode
Hello,
James Harkins <jamshark70@gmail.com> writes:
> I've started to like checklists because they are a good way to keep
> account of things that have to be done, without the individual items
> being entered into the agenda (and thus transferred to MobileOrg).
>
> But I'm running into the limitation that plain lists can't be sorted
> *by their checklist status*. You can sort alphabetically, numerically
> or by time or function. So, I guess I have to write a lisp function to
> do it... but I don't have time to do that right now, but I need to
> sort the list now...
>
> Valid feature request?
There are four states: checked box, unchecked box, transitory box and no
box at all. I can't see an order that should be prevalent over others.
As such, I think it is a specific use-case that should be treated by "f"
or "F" sorting key. Such a sorting function could be an interesting Org
Hacks addition.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-c ^ for plain lists? Why not?
2012-10-08 18:25 ` Nicolas Goaziou
@ 2012-10-09 0:06 ` James Harkins
2012-10-09 7:58 ` Carsten Dominik
1 sibling, 0 replies; 10+ messages in thread
From: James Harkins @ 2012-10-09 0:06 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
On Oct 9, 2012 2:29 AM, "Nicolas Goaziou" <n.goaziou@gmail.com> wrote:
> There are four states: checked box, unchecked box, transitory box and no
> box at all. I can't see an order that should be prevalent over others.
Fair enough, thanks. I'll check the org manual later to see if the format
of the function is documented anywhere. (I might have time to try my hand
at the function, but I wouldn't have time to guess the expected output and
inputs.)
hjh
[-- Attachment #2: Type: text/html, Size: 590 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-c ^ for plain lists? Why not?
2012-10-08 18:25 ` Nicolas Goaziou
2012-10-09 0:06 ` James Harkins
@ 2012-10-09 7:58 ` Carsten Dominik
2012-10-27 7:57 ` Bastien
2012-12-28 3:27 ` James Harkins
1 sibling, 2 replies; 10+ messages in thread
From: Carsten Dominik @ 2012-10-09 7:58 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: James Harkins, emacs-orgmode
On 8.10.2012, at 20:25, Nicolas Goaziou wrote:
> Hello,
>
> James Harkins <jamshark70@gmail.com> writes:
>
>> I've started to like checklists because they are a good way to keep
>> account of things that have to be done, without the individual items
>> being entered into the agenda (and thus transferred to MobileOrg).
>>
>> But I'm running into the limitation that plain lists can't be sorted
>> *by their checklist status*. You can sort alphabetically, numerically
>> or by time or function. So, I guess I have to write a lisp function to
>> do it... but I don't have time to do that right now, but I need to
>> sort the list now...
>>
>> Valid feature request?
>
> There are four states: checked box, unchecked box, transitory box and no
> box at all. I can't see an order that should be prevalent over others.
I would think that
checked - transitionary - unchecked - no box
is a pretty decent default.
>
> As such, I think it is a specific use-case that should be treated by "f"
> or "F" sorting key. Such a sorting function could be an interesting Org
> Hacks addition.
Playing with this idea I noticed that the sorting function
did not accept their additional arguments like sorting-key
and get key-function in they way they should. So I patched
them, to make the following work in the current master:
(defun org-sort-list-by-checkbox-type ()
"Sort list items according to Checkbox state."
(interactive)
(org-sort-list
nil ?f
(lambda ()
(if (looking-at org-list-full-item-re)
(cdr (assoc (match-string 3)
'(("[X]" . 1) ("[-]" . 2) ("[ ]" . 3) (nil . 4))))
4))))
Depending on how you want the sorting, you can change ?f to ?F to
reverse, and/or you can change the numbers in the alist to modify
the sort order in any way you like.
HTH!
- Carsten
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-c ^ for plain lists? Why not?
2012-10-09 7:58 ` Carsten Dominik
@ 2012-10-27 7:57 ` Bastien
2012-12-28 3:27 ` James Harkins
1 sibling, 0 replies; 10+ messages in thread
From: Bastien @ 2012-10-27 7:57 UTC (permalink / raw)
To: Carsten Dominik; +Cc: James Harkins, emacs-orgmode, Nicolas Goaziou
Carsten Dominik <carsten.dominik@gmail.com> writes:
> I would think that
>
> checked - transitionary - unchecked - no box
>
> is a pretty decent default.
+1
> (defun org-sort-list-by-checkbox-type ()
> "Sort list items according to Checkbox state."
> (interactive)
> (org-sort-list
> nil ?f
> (lambda ()
> (if (looking-at org-list-full-item-re)
> (cdr (assoc (match-string 3)
> '(("[X]" . 1) ("[-]" . 2) ("[ ]" . 3) (nil . 4))))
> 4))))
Thanks -- I added this on Worg's hacks:
http://orgmode.org/worg/org-hacks.html#sec-1-2-9
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-c ^ for plain lists? Why not?
2012-10-09 7:58 ` Carsten Dominik
2012-10-27 7:57 ` Bastien
@ 2012-12-28 3:27 ` James Harkins
2012-12-28 10:02 ` Bastien
1 sibling, 1 reply; 10+ messages in thread
From: James Harkins @ 2012-12-28 3:27 UTC (permalink / raw)
To: emacs-orgmode
Carsten Dominik <carsten.dominik <at> gmail.com> writes:
> Playing with this idea I noticed that the sorting function
> did not accept their additional arguments like sorting-key
> and get key-function in they way they should. So I patched
> them, to make the following work in the current master:
>
> (defun org-sort-list-by-checkbox-type ()
> "Sort list items according to Checkbox state."
> (interactive)
> (org-sort-list
> nil ?f
> (lambda ()
> (if (looking-at org-list-full-item-re)
> (cdr (assoc (match-string 3)
> '(("[X]" . 1) ("[-]" . 2) ("[ ]" . 3) (nil . 4))))
> 4))))
I finally had a chance to play with this -- works nicely, except I managed to
get emacs into an infinite loop this way:
1. C-c ^ f org-sort-list-by-checkbox-type
2. This puts the done items at the top, which I didn't want, so... C-c ^ F org-
sort-list-by-checkbox-type.
3. Emacs goes into a tailspin (recovered by C-g).
> I would think that
>
> checked - transitionary - unchecked - no box
>
> is a pretty decent default.
I disagree. I'd suggest unchecked - transitionary - checked - no box. It makes
more sense to pull the not-done items to the top, no?
But it's easy to modify the function for my environment. Thanks!!
hjh
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-c ^ for plain lists? Why not?
2012-12-28 3:27 ` James Harkins
@ 2012-12-28 10:02 ` Bastien
2012-12-29 0:59 ` James Harkins
0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2012-12-28 10:02 UTC (permalink / raw)
To: James Harkins; +Cc: emacs-orgmode
Hi James,
James Harkins <jamshark70@gmail.com> writes:
> I finally had a chance to play with this -- works nicely, except I managed to
> get emacs into an infinite loop this way:
>
> 1. C-c ^ f org-sort-list-by-checkbox-type
> 2. This puts the done items at the top, which I didn't want, so... C-c ^ F org-
> sort-list-by-checkbox-type.
> 3. Emacs goes into a tailspin (recovered by C-g).
`org-list-get-item-end-before-blank' is meant to be used as an
interactive function directly, not as a callback within `org-sort-list'.
HTH,
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-c ^ for plain lists? Why not?
2012-12-28 10:02 ` Bastien
@ 2012-12-29 0:59 ` James Harkins
2012-12-29 5:04 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: James Harkins @ 2012-12-29 0:59 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
On Dec 29, 2012 1:40 AM, "Bastien" <bzg@altern.org> wrote:
> >
> > 1. C-c ^ f org-sort-list-by-checkbox-type
> > 2. This puts the done items at the top, which I didn't want, so... C-c
^ F org-
> > sort-list-by-checkbox-type.
> > 3. Emacs goes into a tailspin (recovered by C-g).
>
> `org-list-get-item-end-before-blank' is meant to be used as an
> interactive function directly, not as a callback within `org-sort-list'.
I'm afraid this means rather little to me, and I haven't time now (in the
middle of end-of-semester grading) to dig in and find where
org-list-get-item-end-before-blank is being invoked from a function that
doesn't directly reference it.
Since it's published hack, probably this should be fixed and updated on
worg, or a note added to explain that you shouldn't use F with this
function for now.
hjh
[-- Attachment #2: Type: text/html, Size: 1058 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-c ^ for plain lists? Why not?
2012-10-08 14:41 C-c ^ for plain lists? Why not? James Harkins
2012-10-08 18:25 ` Nicolas Goaziou
@ 2012-10-11 17:48 ` François Pinard
1 sibling, 0 replies; 10+ messages in thread
From: François Pinard @ 2012-10-11 17:48 UTC (permalink / raw)
To: emacs-orgmode
James Harkins <jamshark70@gmail.com> writes:
> But I'm running into the limitation that plain lists can't be sorted
> *by their checklist status*. You can sort alphabetically, numerically
> or by time or function.
Hi, Org people.
Just quickly perusing this list, this message reminds me of an old
annoyance in Org sorting, by which [[A]][C]] and [[B]] were sorted along
A-C followed by B, while I would have hoped to see B first and C second.
In other words, they were sorted according to invisible criteria, while
I would have hoped them to be sorted according to what I see. But I did
not recently check if this has been addressed since then.
François
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-12-29 5:04 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-08 14:41 C-c ^ for plain lists? Why not? James Harkins
2012-10-08 18:25 ` Nicolas Goaziou
2012-10-09 0:06 ` James Harkins
2012-10-09 7:58 ` Carsten Dominik
2012-10-27 7:57 ` Bastien
2012-12-28 3:27 ` James Harkins
2012-12-28 10:02 ` Bastien
2012-12-29 0:59 ` James Harkins
2012-12-29 5:04 ` Bastien
2012-10-11 17:48 ` François Pinard
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).