From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#18051: 24.3.92; ls-lisp: Sorting; make ls-lisp-string-lessp a normal function? Date: Sat, 23 Aug 2014 12:05:51 +0300 Message-ID: <83a96vmv80.fsf@gnu.org> References: <87ha2f5gp8.fsf@web.de> <87a987ht5r.fsf@gmx.de> <83y4vq6cz3.fsf@gnu.org> <87tx6c7f5v.fsf@web.de> <8338dw5zrf.fsf@gnu.org> <87lhro7dp4.fsf@web.de> <83zjg44jzd.fsf@gnu.org> <87wqb8mqqv.fsf@web.de> <83y4vo4fbr.fsf@gnu.org> <87silwmo8h.fsf@web.de> <83wqb84e7l.fsf@gnu.org> <87iomsgsqg.fsf@gmx.de> <83tx6c44x7.fsf@gnu.org> <87egxggigj.fsf@gmx.de> <877g28w19r.fsf@gmx.de> <83sikvcbqr.fsf@gnu.org> <83r40fc876.fsf@gnu.org> <87wqa7uf7w.fsf@gmx.de> <83oavjc5jj.fsf@gnu.org> <87y4uixleg.fsf@gmx.de> <83sikpc3cd.fsf@gnu.org> <87ha147gd5.fsf@gmx.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1408784785 20506 80.91.229.3 (23 Aug 2014 09:06:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Aug 2014 09:06:25 +0000 (UTC) Cc: michael_heerdegen@web.de, 18051@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 23 11:06:18 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XL7H7-00059K-IV for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Aug 2014 11:06:17 +0200 Original-Received: from localhost ([::1]:40424 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XL7H6-0000uT-W8 for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Aug 2014 05:06:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XL7Gy-0000u4-Py for bug-gnu-emacs@gnu.org; Sat, 23 Aug 2014 05:06:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XL7Gt-0007IR-3N for bug-gnu-emacs@gnu.org; Sat, 23 Aug 2014 05:06:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XL7Gt-0007IN-03 for bug-gnu-emacs@gnu.org; Sat, 23 Aug 2014 05:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XL7Gs-0006d0-HJ for bug-gnu-emacs@gnu.org; Sat, 23 Aug 2014 05:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Aug 2014 09:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18051 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18051-submit@debbugs.gnu.org id=B18051.140878475925469 (code B ref 18051); Sat, 23 Aug 2014 09:06:02 +0000 Original-Received: (at 18051) by debbugs.gnu.org; 23 Aug 2014 09:05:59 +0000 Original-Received: from localhost ([127.0.0.1]:49941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XL7Go-0006ci-GP for submit@debbugs.gnu.org; Sat, 23 Aug 2014 05:05:59 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:33105) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XL7Gm-0006cQ-4M for 18051@debbugs.gnu.org; Sat, 23 Aug 2014 05:05:57 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NAR0020053C4900@a-mtaout22.012.net.il> for 18051@debbugs.gnu.org; Sat, 23 Aug 2014 12:05:49 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NAR0020A59P4510@a-mtaout22.012.net.il>; Sat, 23 Aug 2014 12:05:49 +0300 (IDT) In-reply-to: <87ha147gd5.fsf@gmx.de> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92619 Archived-At: > From: Michael Albinus > Cc: michael_heerdegen@web.de, 18051@debbugs.gnu.org > Date: Fri, 22 Aug 2014 16:23:34 +0200 > > > . I suggest to factor out the part that converts to wchar_t, sets up > > the locale, and calls strcoll. The code you wrote makes certain > > assumptions about 'setlocale', and also about the wchar_t > > representation. Factoring those system-dependent parts out will > > minimize the number of #ifdef's needed to provide such features for > > other platforms. > > I see. But I don't know how to factor out. Shall I move str_collate to > another file? Or to a new file? Something else? I think everything in str_collate starting with the "Convert byte stream to code pointers." comment (btw, I guess you meant "code points" here) should be in a separate function, and the best place for that function is sysdep.c. At least on MS-Windows, both the part that converts a Lisp string into wchar_t array, and the part that performs a locale-sensitive string comparison, will be implemented differently. > > . I think glibc has a 'newlocale' API that is better suited to this > > kind of jobs. In particular, 'setlocale' changes the locale of the > > entire program, which is bad news for other threads that might be > > using some locale-aware functions while the main thread calls > > string-collate-lessp. (We have more than 1 thread in Emacs built > > with GTK, for example, and who knows what those threads might be > > doing?) > > OK, done. Thanks. (You didn't attach the new patch.) Btw, I wonder whether we should have a way to pass the locale string explicitly, instead of relying on $LC_COLLATE. > I have added also configure checks HAVE_NEWLOCALE, HAVE_USELOCALE and > HAVE_FREELOCALE for the respective glibc functions. I don't know whether > it is overengineering, and whether I could simply apply the existing > HAVE_SETLOCALE check. I believe all these functions do exist in parallel > in locale.h, don't they? I'll defer to glibc experts on that. My knowledge of 'newlocale' facilities is limited to what I saw in Guile's i18n.c module.