From f1c504eae7a46d24e679c992c093b8bcd63ab32b Mon Sep 17 00:00:00 2001 From: Rasmus Date: Mon, 10 Aug 2015 16:44:10 +0200 Subject: 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. --- lisp/emms-browser.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lisp') 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))) -- cgit v1.2.3