aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--lisp/emms-browser.el13
2 files changed, 12 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 65c439b..d1b17af 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ News since version 4.0:
- emms-lyrics.el now uses eww if present. Also EMMS tries to fetch
non-Chinese lyrics from lyricwiki.org.
- Add HTTPS support where possible.
+ - Sort using locale language in the browser, if possible.
News since version 3.0:
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)))