org-list: small corrections to sort list

* lisp/org-list.el (org-sort-list): fix number of arguments to
  `org-list-repair', plus make end-record go to end of item before any
  blank line to keep them from being swallowed in the sorting.
This commit is contained in:
Nicolas Goaziou 2011-01-02 19:25:52 +01:00
parent 884d983188
commit c32e39786d
1 changed files with 5 additions and 2 deletions

View File

@ -2351,7 +2351,8 @@ compare entries."
(skip-chars-forward " \r\t\n")
(beginning-of-line)))
(end-record (lambda ()
(goto-char (org-list-get-item-end (point) struct))))
(goto-char (org-list-get-item-end-before-blank
(point) struct))))
(value-to-sort
(lambda ()
(when (looking-at "[ \t]*[-+*0-9.)]+\\([ \t]+\\[[- X]\\]\\)?[ \t]+")
@ -2385,7 +2386,9 @@ compare entries."
value-to-sort
nil
sort-func)
(org-list-repair nil)
;; Read and fix list again, as `sort-subr' probably destroyed
;; its structure.
(org-list-repair)
(run-hooks 'org-after-sorting-entries-or-items-hook)
(message "Sorting items...done")))))