diff options
author | Rasmus <rasmus@gmx.us> | 2015-08-10 16:44:10 +0200 |
---|---|---|
committer | Rasmus <rasmus@gmx.us> | 2015-08-10 16:44:10 +0200 |
commit | f1c504eae7a46d24e679c992c093b8bcd63ab32b (patch) | |
tree | 6d2e4bfd0af014fb1ea609ac6adbc419f29e17df | |
parent | 55ff581b1e7d8b0b290834e87221baadd95db1ff (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.
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | lisp/emms-browser.el | 13 |
2 files changed, 12 insertions, 2 deletions
@@ -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))) |