From: "Sebastian Reuße" <seb@wirrsal.net>
To: emacs-orgmode@gnu.org
Cc: "Sebastian Reuße" <seb@wirrsal.net>
Subject: [PATCH 1/6] Fix alphabetic sorting for tables, plain lists
Date: Sun, 11 Mar 2018 16:43:47 +0100 [thread overview]
Message-ID: <20180311154352.16920-1-seb@wirrsal.net> (raw)
* org-table.el (org-table-sort-lines): Use collated sorting.
* org-list.el (org-sort-list): Use collated sorting.
Cf. commit 551d2f1fe.
---
etc/ORG-NEWS | 6 ++++++
lisp/org-list.el | 5 +++--
lisp/org-table.el | 2 +-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index dbedbf7c9..77373d442 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 9e015cdc2..d646e264c 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2804,7 +2804,8 @@ (defun org-sort-list
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 @@ (defun org-sort-list
(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 f303c2581..316533172 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -1794,7 +1794,7 @@ (defun org-table-sort-lines
(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?
--
2.16.2
next reply other threads:[~2018-03-11 15:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-11 15:43 Sebastian Reuße [this message]
2018-03-11 15:43 ` [PATCH 2/6] Fix alphabetic string matching operators Sebastian Reuße
2018-03-11 16:09 ` [PATCH] " Sebastian Reuße
2018-03-13 8:13 ` Nicolas Goaziou
2018-03-11 16:11 ` [PATCH 2/6] " Sebastian Reuße
2018-03-11 15:43 ` [PATCH 3/6] Fix org-table-sort-lines test Sebastian Reuße
2018-03-13 8:13 ` Nicolas Goaziou
2018-03-11 15:43 ` [PATCH 4/6] Fix string-collate-lessp shim Sebastian Reuße
2018-03-13 8:12 ` Nicolas Goaziou
2018-03-11 15:43 ` [PATCH 5/6] org-table-sort-lines: Fix case-sensitive sorting Sebastian Reuße
2018-03-13 8:13 ` Nicolas Goaziou
2018-03-11 15:43 ` [PATCH 6/6] Improve ‘org-sort-list’ test Sebastian Reuße
2018-03-13 8:13 ` Nicolas Goaziou
2018-03-13 8:12 ` [PATCH 1/6] Fix alphabetic sorting for tables, plain lists Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180311154352.16920-1-seb@wirrsal.net \
--to=seb@wirrsal.net \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).