Bladeren bron

Add a COMPARE-FUNC argument to the internal sorting routine.

Patch by John Wiegley.
Carsten Dominik 17 jaren geleden
bovenliggende
commit
f796043bf1
2 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen
  1. 3 0
      lisp/ChangeLog
  2. 3 1
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2008-12-18  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-sort-entries-or-items): Add a COMPARE-FUNC
+	argument.
+
 	* org-agenda.el (org-agenda-set-tags): Leave getting the tags to
 	`org-agenda-change-all-lines'.
 	(org-agenda-change-all-lines): Removed FORCE-TAGS argument, the

+ 3 - 1
lisp/org.el

@@ -5434,7 +5434,8 @@ Optional argument WITH-CASE means sort case-sensitively."
 
 (defvar org-priority-regexp) ; defined later in the file
 
-(defun org-sort-entries-or-items (&optional with-case sorting-type getkey-func property)
+(defun org-sort-entries-or-items
+  (&optional with-case sorting-type getkey-func compare-func property)
   "Sort entries on a certain level of an outline tree.
 If there is an active region, the entries in the region are sorted.
 Else, if the cursor is before the first entry, sort the top-level items.
@@ -5614,6 +5615,7 @@ WITH-CASE, the sorting considers case as well."
          (cond
           ((= dcst ?a) 'string<)
           ((= dcst ?t) 'time-less-p)
+          ((= dcst ?f) compare-func)
           (t nil)))))
     (message "Sorting entries...done")))