From: Bastien Guerry Date: Sat, 29 Dec 2012 05:02:05 +0000 (+0100) Subject: Update the `org-sort-list-by-checkbox-type' hack. X-Git-Tag: release_7.9.3~12^2 X-Git-Url: http://orgmode.org/w/?p=worg.git;a=commitdiff_plain;h=d1c55a6a31f59c49c7d9de6b11056ea2dedc35af Update the `org-sort-list-by-checkbox-type' hack. Distinguish between `org-sort-list-by-checkbox-type' as called directly on to the list, and `org-sort-list-by-checkbox-type-1' as a callback for the org-sort function. Thanks to James Harkins for reporting this problem. --- diff --git a/org-hacks.org b/org-hacks.org index e27bdf6..b10b4d7 100644 --- a/org-hacks.org +++ b/org-hacks.org @@ -1,10 +1,10 @@ +#+TITLE: Org ad hoc code, quick hacks and workarounds +#+AUTHOR: Worg people +#+EMAIL: mdl AT imapmail DOT org #+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@) #+TAGS: Write(w) Update(u) Fix(f) Check(c) -#+TITLE: Org ad hoc code, quick hacks and workarounds -#+AUTHOR: Worg people -#+EMAIL: mdl AT imapmail DOT org #+LANGUAGE: en #+PRIORITIES: A C B #+CATEGORY: worg @@ -540,8 +540,8 @@ If you think you might have subtrees with misplaced =SCHEDULED= and #+index: checkbox!sorting -You can use a custom function to sort list by checkbox type. Here is a -function suggested by Carsten: +You can use a custom function to sort list by checkbox type. +Here is a function suggested by Carsten: #+BEGIN_SRC emacs-lisp (defun org-sort-list-by-checkbox-type () @@ -556,6 +556,18 @@ function suggested by Carsten: 4)))) #+END_SRC +Use the function above directly on the list. If you want to use an +equivalent function after =C-c ^ f=, use this one instead: + +#+BEGIN_SRC emacs-lisp + (defun org-sort-list-by-checkbox-type-1 () + (lambda () + (if (looking-at org-list-full-item-re) + (cdr (assoc (match-string 3) + '(("[X]" . 1) ("[-]" . 2) ("[ ]" . 3) (nil . 4)))) + 4))) +#+END_SRC + ** Org Table *** Align all tables in a file