summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Reuße <seb@wirrsal.net>2018-03-11 16:43:47 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-03-13 09:09:07 +0100
commite64ff15f678c62552d0e0329fee622b299fa3d02 (patch)
treeccc2adc1baba4f25ee34356cd8ddf8e9c3ce51fb
parent258996a9a66759cd9e6580e28a6338963bd999f2 (diff)
downloadorg-mode-e64ff15f678c62552d0e0329fee622b299fa3d02.tar.gz
Fix alphabetic sorting for tables, plain lists
* org-table.el (org-table-sort-lines): Use collated sorting. * org-list.el (org-sort-list): Use collated sorting. Cf. commit 551d2f1fe.
-rw-r--r--etc/ORG-NEWS6
-rw-r--r--lisp/org-list.el5
-rw-r--r--lisp/org-table.el2
3 files changed, 10 insertions, 3 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index dbedbf7..77373d4 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -106,6 +106,12 @@ document, use =shrink= value instead, or in addition to align:
,#+STARTUP: align shrink
#+END_EXAMPLE
+*** Alphabetic sorting in tables and lists
+
+When sorting alphabetically, ~org-table-sort-lines~ and ~org-sort-list~
+now sort according to the locale’s collation rules instead of by
+code-point.
+
** New features
*** Add support for links to LaTeX equations in HTML export
Use MathJax links when enabled (by ~org-html-with-latex~), otherwise
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 9e015cd..d646e26 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2804,7 +2804,8 @@ Sorting can be alphabetically, numerically, by date/time as given
by a time stamp, by a property or by priority.
Comparing entries ignores case by default. However, with an
-optional argument WITH-CASE, the sorting considers case as well.
+optional argument WITH-CASE, the sorting considers case as well,
+if the current locale allows for it.
The command prompts for the sorting type unless it has been given
to the function through the SORTING-TYPE argument, which needs to
@@ -2850,7 +2851,7 @@ function is being called interactively."
(error "Missing key extractor"))))
(sort-func
(cond
- ((= dcst ?a) #'string<)
+ ((= dcst ?a) #'org-string-collate-lessp)
((= dcst ?f)
(or compare-func
(and interactive?
diff --git a/lisp/org-table.el b/lisp/org-table.el
index f303c25..3165331 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -1794,7 +1794,7 @@ function is being called interactively."
(predicate
(cl-case sorting-type
((?n ?N ?t ?T) #'<)
- ((?a ?A) #'string<)
+ ((?a ?A) #'org-string-collate-lessp)
((?f ?F)
(or compare-func
(and interactive?