From: Carsten Dominik <carsten.dominik@gmail.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: James Harkins <jamshark70@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: C-c ^ for plain lists? Why not?
Date: Tue, 9 Oct 2012 09:58:11 +0200 [thread overview]
Message-ID: <540B116A-148E-46E5-94EA-5965B206613B@gmail.com> (raw)
In-Reply-To: <87pq4srfc6.fsf@gmail.com>
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
next prev parent reply other threads:[~2012-10-09 7:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=540B116A-148E-46E5-94EA-5965B206613B@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=jamshark70@gmail.com \
--cc=n.goaziou@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).