[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] C-c ^ for plain lists? Why not?

From: Carsten Dominik
Subject: Re: [O] C-c ^ for plain lists? Why not?
Date: Tue, 9 Oct 2012 09:58:11 +0200

On 8.10.2012, at 20:25, Nicolas Goaziou wrote:

> Hello,
> James Harkins <address@hidden> 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."
   nil ?f
   (lambda ()
     (if (looking-at org-list-full-item-re)
         (cdr (assoc (match-string 3)
                     '(("[X]" . 1) ("[-]" . 2) ("[ ]" . 3) (nil . 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.


- Carsten

reply via email to

[Prev in Thread] Current Thread [Next in Thread]