aboutsummaryrefslogtreecommitdiff
path: root/lisp/emms-browser.el
diff options
context:
space:
mode:
authorRasmus <rasmus@gmx.us>2015-08-10 16:44:10 +0200
committerRasmus <rasmus@gmx.us>2015-08-10 16:44:10 +0200
commitf1c504eae7a46d24e679c992c093b8bcd63ab32b (patch)
tree6d2e4bfd0af014fb1ea609ac6adbc419f29e17df /lisp/emms-browser.el
parent55ff581b1e7d8b0b290834e87221baadd95db1ff (diff)
Sort using locale language in the browser
- Use string-collate-lessp if available for alphabetic sorting. - Use emms-browser-alpha-sort-function to sort in the browser.
Diffstat (limited to 'lisp/emms-browser.el')
-rw-r--r--lisp/emms-browser.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/emms-browser.el b/lisp/emms-browser.el
index dab1428..9f5a1db 100644
--- a/lisp/emms-browser.el
+++ b/lisp/emms-browser.el
@@ -374,7 +374,7 @@ Ues nil for no sorting."
:type 'function)
(defcustom emms-browser-alpha-sort-function
- 'string<
+ (if (functionp 'string-collate-lessp) 'string-collate-lessp 'string<)
"*How to sort artists/albums/etc. in the browser.
Use nil for no sorting."
:group 'emms-browser
@@ -684,7 +684,16 @@ compilations, etc."
db)
(emms-with-inhibit-read-only-t
(let ((sort-fold-case t))
- (sort-lines nil (point-min) (point-max)))))
+ (if emms-browser-alpha-sort-function
+ (progn
+ (goto-char (point-min))
+ (sort-subr nil
+ #'forward-line #'end-of-line
+ (lambda () (buffer-substring-no-properties
+ (line-beginning-position) (line-end-position)))
+ nil
+ emms-browser-alpha-sort-function))
+ (sort-lines nil (point-min) (point-max))))))
(defun case-fold-string= (a b)
(eq t (compare-strings a nil nil b nil nil t)))